src/run.js
function run(commands, done) {
  var children = [];
  var pending = commands.length || 1;
  var err;
  each(commands, function(command, next) {
    children.push(childProcess.spawn(shell[0], [shell[1], command], {
      stdio: ['pipe', process.stdout, process.stderr]
    }).on('exit', function(code) {
      if (!err && code > 0) {
        err = new Error('`' + command + '` failed with exit code ' + code);
        children.forEach(function(child) {
          if (child.connected) child.kill();
        });
      }
      pending -= 1;
      if (pending === 0) done(err);
    }));
    next();
  });
}
function run(commands, done) {
  var children = [];
  var pending = commands.length || 1;
  var err;
  each(commands, function(command, next) {
    children.push(childProcess.spawn(shell[0], [shell[1], command], {
      stdio: ['pipe', process.stdout, process.stderr]
    }).on('exit', function(code) {
      if (!err && code > 0) {
        err = new Error('`' + command + '` failed with exit code ' + code);
        children.forEach(function(child) {
          if (child.connected) child.kill();
        });
      }
      pending -= 1;
      if (pending === 0) done(err);
    }));
    next();
  });
}
function run ( commands , done ) { var children = [ ] ; var pending = commands . length || 1 ; var err ; each ( commands , function ( command , next ) { children . push ( childProcess . spawn ( shell [ 0 ] , [ shell [ 1 ] , command ] , { stdio : [ 'pipe' , process . stdout , process . stderr ] } ) . on ( 'exit' , function ( code ) { if ( ! err && code > 0 ) { err = new Error ( '`' + command + '` failed with exit code ' + code ) ; children . forEach ( function ( child ) { if ( child . connected ) child . kill ( ) ; } ) ; } pending -= 1 ; if ( pending === 0 ) done ( err ) ; } ) ) ; next ( ) ; } ) ; }
Runs each command in parallel.
@param {Array.<string>} commands
@param {function(Error=)} done
Runs each command in parallel .