Better '$' error handling

This commit is contained in:
2025-08-10 12:43:03 -04:00
parent c2b3d7dc3c
commit ce2208f1b2
2 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import {exec, execSync} from 'child_process';
export function $(str: TemplateStringsArray, ...args: string[]): Promise<string> {
let cmd = str.reduce((acc, part, i) => acc + part + (args[i] || ''), '');
return new Promise((res, rej) => exec(cmd, (err, stdout, stderr) => {
if(err || stderr) return rej(err || stderr);
if(err) return rej(stderr || err);
return res(stdout);
}))
}