This commit is contained in:
Benjamin Toby
2025-01-13 22:50:42 +01:00
parent f56f2849e0
commit a3440692a9
21 changed files with 730 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
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;
}
}