Skip to content
Merged
Prev Previous commit
Next Next commit
fix: better run command error handling
Signed-off-by: Amin Yahyaabadi <[email protected]>
  • Loading branch information
aminya committed Mar 30, 2024
commit 22eb27ec1af920acf18977b22bfdaa8f1c00e77d
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
14 changes: 10 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import spawn from 'spawn-please'

export function run(command: string, args: string[]) {
return spawn(command, args, {}, { stdout: 'inherit' });
export async function run(command: string, args: string[]) {
try {
return await spawn(command, args, {}, { stdout: 'inherit', stderr: 'inherit' });
} catch (error) {
console.error(`Error running command: ${command} ${args.join(' ')}`);
throw error;
}
}