mirror of
https://github.com/tappollo/booster.git
synced 2026-06-15 16:07:33 +08:00
19 lines
377 B
TypeScript
19 lines
377 B
TypeScript
import { exec } from "child_process";
|
|
|
|
export const run = (command: string) =>
|
|
new Promise((ful, rej) => {
|
|
const { stdout } = exec(command, (error, _, stderr) => {
|
|
if (stderr) {
|
|
console.log(stderr);
|
|
}
|
|
if (error) {
|
|
rej(error);
|
|
} else {
|
|
ful();
|
|
}
|
|
});
|
|
if (stdout) {
|
|
stdout.pipe(process.stdout);
|
|
}
|
|
});
|