Skip to content

Commit 34d1039

Browse files
committed
Merge pull request #13 from quicksnap/exit_codes
Looks good. Thanks!
2 parents e9eaed7 + 3649668 commit 34d1039

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/exec.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ module.exports = function exec(script) {
1515
});
1616

1717
console.log('to be executed:' + command_line);
18-
var command = child_exec(command_line);
19-
18+
var command = child_exec(command_line, function (error, stdout, stderr) {
19+
if (error) {
20+
process.exit(error.code || 1);
21+
}
22+
});
2023
command.stdout.on('data', function(data) {
2124
process.stdout.write(data);
2225
});
@@ -25,6 +28,7 @@ module.exports = function exec(script) {
2528
});
2629
command.on('error', function(err) {
2730
process.stderr.write(err);
31+
process.exit(err.code || 1);
2832
});
2933

30-
}
34+
}

0 commit comments

Comments
 (0)