Skip to content

Commit

Permalink
Handle exit codes
Browse files Browse the repository at this point in the history
  • Loading branch information
quicksnap committed Oct 23, 2015
1 parent e9eaed7 commit 3649668
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ module.exports = function exec(script) {
});

console.log('to be executed:' + command_line);
var command = child_exec(command_line);

var command = child_exec(command_line, function (error, stdout, stderr) {
if (error) {
process.exit(error.code || 1);
}
});
command.stdout.on('data', function(data) {
process.stdout.write(data);
});
Expand All @@ -25,6 +28,7 @@ module.exports = function exec(script) {
});
command.on('error', function(err) {
process.stderr.write(err);
process.exit(err.code || 1);
});

}
}

0 comments on commit 3649668

Please sign in to comment.