source: imaps-frontend/node_modules/cross-spawn/index.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[d565449]1'use strict';
2
3const cp = require('child_process');
4const parse = require('./lib/parse');
5const enoent = require('./lib/enoent');
6
7function spawn(command, args, options) {
8 // Parse the arguments
9 const parsed = parse(command, args, options);
10
11 // Spawn the child process
12 const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
13
14 // Hook into child process "exit" event to emit an error if the command
15 // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
16 enoent.hookChildProcess(spawned, parsed);
17
18 return spawned;
19}
20
21function spawnSync(command, args, options) {
22 // Parse the arguments
23 const parsed = parse(command, args, options);
24
25 // Spawn the child process
26 const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
27
28 // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
29 result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
30
31 return result;
32}
33
34module.exports = spawn;
35module.exports.spawn = spawn;
36module.exports.sync = spawnSync;
37
38module.exports._parse = parse;
39module.exports._enoent = enoent;
Note: See TracBrowser for help on using the repository browser.