spawn-command.js 437 B

123456789101112131415161718
  1. var util = require('util');
  2. var spawn = require('child_process').spawn;
  3. module.exports = function (command, options) {
  4. var file, args;
  5. if (process.platform === 'win32') {
  6. file = 'cmd.exe';
  7. args = ['/s', '/c', '"' + command + '"'];
  8. options = util._extend({}, options);
  9. options.windowsVerbatimArguments = true;
  10. }
  11. else {
  12. file = '/bin/sh';
  13. args = ['-c', command];
  14. }
  15. return spawn(file, args, options);
  16. };