Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. const cp = require('child_process');
  3. const parse = require('./lib/parse');
  4. const enoent = require('./lib/enoent');
  5. function spawn(command, args, options) {
  6. // Parse the arguments
  7. const parsed = parse(command, args, options);
  8. // Spawn the child process
  9. const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
  10. // Hook into child process "exit" event to emit an error if the command
  11. // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
  12. enoent.hookChildProcess(spawned, parsed);
  13. return spawned;
  14. }
  15. function spawnSync(command, args, options) {
  16. // Parse the arguments
  17. const parsed = parse(command, args, options);
  18. // Spawn the child process
  19. const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
  20. // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
  21. result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
  22. return result;
  23. }
  24. module.exports = spawn;
  25. module.exports.spawn = spawn;
  26. module.exports.sync = spawnSync;
  27. module.exports._parse = parse;
  28. module.exports._enoent = enoent;