Spawn an executable

@param {String} command
@param {Array} args
@param {Object} options
@return {Promise}
174291
function spawnCmd(command, args, options) {
    var d = Promise.defer();
    var child = spawn(command, args, options);

    child.on('error', function(error) {
        return d.reject(error);
    });

    child.stdout.on('data', function (data) {
        d.notify(data);
    });

    child.stderr.on('data', function (data) {
        d.notify(data);
    });

    child.on('close', function(code) {
        if (code === 0) {
            d.resolve();
        } else {
            d.reject(new Error('Error with command "'+command+'"'));
        }
    });

    return d.promise;
}
354828
function execPromise (cmd) {
  if (isTest) {
    return Promise.resolve(cmd)
  }
  return new Promise((resolve, reject) => {
    exec(cmd, (err, stdout, stderr) => {
      if (err || stderr) reject(err || stderr)
      else resolve(stdout)
    })
  })
}
468654
def exec_cmd(self, command, **kwargs):
        

        if command == 'load':
            if kwargs:
                kwargs = dict(options=[kwargs])
        return self._exec_cmd(command, **kwargs)
756721
function exec(cmd, args, stdin, callback) {
            var stdout = concat();
            var stderr = concat();

            var process = child_process.spawn(cmd, args, {
                stdio: [stdin || 'ignore', 'pipe', 'pipe']
            });
            process.stdout.pipe(stdout);
            process.stderr.pipe(stderr);
            process.on('exit', function(code, signal) {
              var err;
              if (code) {
                err = new Error(code);
                err.code = code;
                err.signal = signal;
              }
              callback(err, stdout, stderr);
            });
            process.on('error', function (err) {
              callback(err, stdout, stderr);
            });
        }
1166137
function runCommand(command, fail, log) {
  return new Promise(function(resolve, reject) {
      if (!command) {
        return resolve('No command found');
      }

      log(command);

      var task = exec(command, {
        cwd: process.cwd()
      }, function(err, stdout, stderr) {
        log(stdout);

        if (err) {
          log(stderr, { color: 'red' });
        }
      });

      task.on('exit', function(code) {
        if (code !== 0 && fail) {
          reject(code);
        }

        resolve(command);
        process.stdin.end();
      });

      process.stdin.pipe(task.stdin, { end: false });
    });
}
466706
function runCommand(cmd, args, options) {
  return new Promise((resolve, reject) => {
    const spwan = spawn(
      cmd,
      args,
      Object.assign(
        {
          cwd: process.cwd(),
          stdio: 'inherit',
          shell: true,
        },
        options
      )
    )

    spwan.on('exit', () => {
      resolve()
    })
  })
}
993413
function execProcess(command, options, onClose) {
    const procStart = process.hrtime(),
          cmd = command.join(' '),
          opts = options || {};

    childProcess.exec(cmd, opts, (error, stdout, stderr) => {
        const procEnd = process.hrtime(procStart),
              end = (procEnd[0] + procEnd[1] / 1e9).toFixed(2);

        logger.debug('Process output: %s', stdout);
        if (error) {
            logger.error('Process error: %s', stderr);
        }
        logger.debug('Execution time: %d sec', end);

        if (onClose) {
            onClose(error);
        }
    });
}
1110780
function exec (cmd, callback) {
  debug('executing cmd', cmd)
  child_process.exec(cmd, function (err, stdout, stderr) {
    debug('command completed')
    if (err) {
      if (callback) {
        callback(err)
      }
    } else {
      if (callback) {
        callback(null, stdout, stderr)
      }
    }
  })
}
902448
def start_exec(command, options)
      all_args = command.args
      all_args << options
      self.send(command.name, *all_args)
    end
772391
function runCmd(cmd, args, fn) {
    args = args || [];
    let runner = require('child_process').spawn(cmd, args, {
        // keep color
        stdio: 'inherit',
    });
    runner.on('close', function(code) {
        if (fn) {
            fn(code);
        }
    });
}
76120
function run(cmd, args, options) {
  if (process.env.SLS_DEBUG) console.log('Running', cmd, args.join(' '));

  const stdio = process.env.SLS_DEBUG && options && options.showOutput
    ? ['pipe', 'inherit', 'pipe'] : 'pipe';
  const ps = child_process.spawnSync(cmd, args, {encoding: 'utf-8', 'stdio': stdio});
  if (ps.error) {
    if (ps.error.code === 'ENOENT') {
      throw new Error(`${cmd} not found! Please install it.`);
    }
    throw new Error(ps.error);
  } else if (ps.status !== 0) {
    throw new Error(ps.stderr);
  }
  return ps;
}
827984
function execCmd(cmd, allowedErrors = []) {
  debug(`About to execute cmd: ${cmd} with allowed errors: ${JSON.stringify(allowedErrors)}`);
  return exec(cmd, {})
    .then((result) => {
      debug(`Executed successfully cmd: ${cmd}: `, result.stdout);
      const { stdout } = result;
      return stdout;
    })
    .catch((error) => {
      debug(`Executed with error cmd: ${cmd}: `, error.stdout, error.stderr);
      if (allowedErrors.some(allowedError => allowedError.test(error.stderr))) {
        return Promise.resolve(error.stderr);
      }
      return Promise.reject(error);
    });
}
30858
function spawnInstall(command, args) {
  return new Promise((resolve, reject) => {
    // Spawn install process
    const installProcess = spawn(command, args, {
      cwd: process.cwd(),
      // Something to do with this, progress bar only shows if stdio is inherit
      // https://github.com/yarnpkg/yarn/issues/2200
      stdio: "inherit"
    });
    installProcess.on("error", err => reject(err));
    installProcess.on("close", code => {
      if (code !== 0) {
        return reject(
          new Error(`The install process exited with error code ${code}.`)
        );
      }
      return resolve();
    });
  });
}
369618
function exec (cmd) {

        var deferred = Q.defer();

        faithfulExec(cmd)
            .then(function (result) {
                deferred.resolve(result);
            }, function (result) {
                deferred.reject(result);
            });

        return deferred.promise;

    }
1359375
function exec(cmd, args, opts) {
  console.log(`Running command: ${cmd} ${args.join(' ')}`);
  const cp = childProcessSpawn(cmd, args, opts);

  cp.stdout.on('data', data => log(data));
  cp.stderr.on('data', data => log(data));

  return new Promise((resolve, reject) => {
    cp.on('error', err => reject(log(err)));
    cp.on('exit', code => resolve(code));
  });
}
348776
function(args, options, cb) {

                args = !_.isArray(args) ? [args] : args;
                args = options && args.concat(helper.optsToArgs(options)) || args;

                var child = grunt.util.spawn({
                    cmd:"node",
                    args:args
                }, function (error, result, code) {
                    cb(error);
                });

                child.stdout.pipe(process.stdout);
                child.stderr.pipe(process.stderr);

            }
742165
function Run(path, options, callback) {
    var p = Spawn(path, options.args),
        err = "",
        data = "";

    if (options.remove !== false) {
        Fs.unlink(path, () => {});
    }

    if (options.stdin) {
        options.stdin.pipe(p.stdin);
    }

    if (options.stdout) {
        p.stdout.pipe(options.stdout);
    } else {
        p.stdout.on("data", function (chunk) {
            data += chunk.toString();
        });
    }

    if (options.stderr) {
        p.stderr.pipe(options.stderr);
    } else {
        p.stderr.on("data", function (err) {
            err += err.toString();
        });
    }

    p.on("close", function () {
        callback([null, err][Number(!!err)], data.slice(0, -1));
    });
}