Skip to content

Commit

Permalink
#19 Fixed issue in throwing error on failure case
Browse files Browse the repository at this point in the history
  • Loading branch information
navarasu committed Jul 16, 2020
1 parent 0d8cda5 commit 8cb99bd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ Promise.promisifyAll(fs);

function runCommand(cmd,args,options,cli) {
const ps = spawnSync(cmd, args,options);
cli.log(ps.stdout.toString())
if (ps.error && ps.error.code != 'ENOENT') {
cli.log(ps.stderr.toString())
if (ps.stdout && this.debug){
cli.log(ps.stdout.toString())
}
if (ps.stderr){
cli.log(ps.stderr.toString())
}
if (ps.error && !ps.error.code == 'ENOENT') {
throw new Error(ps.error);
} else if (ps.status !== 0) {
cli.log(ps.stderr.toString())
throw new Error(ps.stderr);
}
return ps;
Expand Down

0 comments on commit 8cb99bd

Please sign in to comment.