|
'use strict'; |
|
|
|
const cp = require('child_process'); |
|
const parse = require('./lib/parse'); |
|
const enoent = require('./lib/enoent'); |
|
|
|
function spawn(command, args, options) { |
|
|
|
const parsed = parse(command, args, options); |
|
|
|
|
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); |
|
|
|
|
|
|
|
enoent.hookChildProcess(spawned, parsed); |
|
|
|
return spawned; |
|
} |
|
|
|
function spawnSync(command, args, options) { |
|
|
|
const parsed = parse(command, args, options); |
|
|
|
|
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); |
|
|
|
|
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); |
|
|
|
return result; |
|
} |
|
|
|
module.exports = spawn; |
|
module.exports.spawn = spawn; |
|
module.exports.sync = spawnSync; |
|
|
|
module.exports._parse = parse; |
|
module.exports._enoent = enoent; |
|
|