Files
Pake/bin/utils/shell.ts
2024-12-30 15:36:25 +08:00

15 lines
439 B
TypeScript
Vendored

import shelljs from 'shelljs';
import { npmDirectory } from './dir';
export function shellExec(command: string) {
return new Promise<number>((resolve, reject) => {
shelljs.exec(command, { async: true, silent: false, cwd: npmDirectory }, code => {
if (code === 0) {
resolve(0);
} else {
reject(new Error(`Error occurred while executing command "${command}". Exit code: ${code}`));
}
});
});
}