spawn_command.js 421 B

1234567891011121314151617
  1. var spawn = require('child_process').spawn;
  2. var win32 = process.platform === 'win32';
  3. /**
  4. * Normalize a command across OS and spawn it.
  5. *
  6. * @param {String} command
  7. * @param {Array} args
  8. */
  9. module.exports = function spawnCommand(command, args) {
  10. var winCommand = win32 ? 'cmd' : command;
  11. var winArgs = win32 ? ['/c'].concat(command, args) : args;
  12. return spawn(winCommand, winArgs, { stdio: 'inherit' });
  13. };