Skip to content

Commit 2d50507

Browse files
committed
tasks: add error callback option to common.execCmd
1 parent 0676a21 commit 2d50507

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tasks/util/common.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
var fs = require('fs');
22
var exec = require('child_process').exec;
33

4-
exports.execCmd = function(cmd, cb) {
4+
exports.execCmd = function(cmd, cb, errorCb) {
5+
cb = cb ? cb : function() {};
6+
errorCb = errorCb ? errorCb : function(err) { if(err) throw err; };
7+
58
exec(cmd, function(err) {
6-
if(err) throw err;
7-
if(cb) cb();
9+
errorCb(err);
10+
cb();
811
})
912
.stdout.pipe(process.stdout);
1013
};

0 commit comments

Comments
 (0)