16 lines
545 B
TypeScript
16 lines
545 B
TypeScript
|
const execFileRaw = util.promisify(child_process.execFile);
|
||
|
export const exec: typeof execFileRaw = ((
|
||
|
...args: Parameters<typeof execFileRaw>
|
||
|
) =>
|
||
|
execFileRaw(...args).catch((e: any) => {
|
||
|
if (e?.message?.startsWith?.("Command failed")) {
|
||
|
if (e.code > 2 ** 31) e.code |= 0;
|
||
|
const code = e.signal ? `signal ${e.signal}` : `code ${e.code}`;
|
||
|
e.message = `${e.cmd.split(" ")[0]} failed with ${code}`;
|
||
|
}
|
||
|
throw e;
|
||
|
})) as any;
|
||
|
|
||
|
import * as util from 'node:util';
|
||
|
import * as child_process from 'node:child_process';
|