Updates
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user