Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.runCmds = function(cmds, dir, cb) {
// it's valid to send no commands, you just get empty results.
if (is.nullOrUndef(cmds))
return cb(null, [], []);
if (!is.array(cmds))
return cb(new Error('Bad cmds parameter: '+inspect(cmds)));
if (!is.func(cb))
return cb(new Error('Bad cb parameter: '+inspect(cb)));
// one for each entry in the array
var outputs = [];
var codes = [];
// iterator function for async.eachSeries
var iterator = function(cmd, cb) {
// default directorry is the cwd
if (!is.nonEmptyStr(cmd.dir)) cmd.dir = dir;