ionic-team / ionic-app-lib

The library used for using ionic apps - consumed by the CLI and the GUI
44 stars 79 forks source link

cross-spawn-async deprecated #119

Open cescoferraro opened 7 years ago

cescoferraro commented 7 years ago

Some users have been complaining about the npm install step

https://forum.ionicframework.com/t/ionic-freezes-on-installing-npm-packages/59406/3

I have looked under the hood and the code looks OK. It works on my machine. But realized that 'cross-spawn-async' has been deprecated for this one https://github.com/IndigoUnited/node-cross-spawn

Start.runSpawnCommand = function runSpawnCommand(cmd, args) {
  var q = Q.defer();
  var command = cmd + args.join(' ');
  var spawn = require('cross-spawn-async');

  log.debug('Running exec command:', command);

  var spawned = spawn(cmd, args);
  spawned.on('error', function(err) {
    Utils.fail('Unable to run spawn command' + err);
  });
  spawned.stdout.on('data', function(data) {
    log.debug(data.toString());
  });
  spawned.stderr.on('data', function(data) {
    log.debug(data.toString());
  });
  spawned.on('exit', function(code) {
    log.debug('Spawn command completed');
    if (code !== 0) {
      return q.reject('There was an error with the spawned command: ' + command);
    }
    return q.resolve();
  });

  return q.promise;
};