dsql-admin/dsql-app/docker/setup/(utils)/execute.ts
Benjamin Toby a3440692a9 Updates
2025-01-13 22:50:42 +01:00

22 lines
473 B
TypeScript

import { ExecOptions, execSync, ExecSyncOptions } from "child_process";
export default function execute(
cmd: string,
options?: ExecSyncOptions
): string | undefined {
try {
const res = execSync(cmd, {
encoding: "utf-8",
...options,
});
if (typeof res == "string") {
return res.trim();
} else {
return undefined;
}
} catch (error) {
return undefined;
}
}