CoolFace
Apppublic

Umama-at-Bluchip/Quick-UI

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
index.js40 linesDownload Raw Back to cross-spawn
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 arguments9    const parsed = parse(command, args, options);10 11    // Spawn the child process12    const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);13 14    // Hook into child process "exit" event to emit an error if the command15    // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/1616    enoent.hookChildProcess(spawned, parsed);17 18    return spawned;19}20 21function spawnSync(command, args, options) {22    // Parse the arguments23    const parsed = parse(command, args, options);24 25    // Spawn the child process26    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/1629    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;40