function runCLI(cli, args, options) {
  cli = resolveCLI(cli);
  args = [cli].concat(args);
  debug('%s', args.join(' '));
  // Keep it backward compatible as dryRun
  if (typeof options === 'boolean') options = {dryRun: options};
  options = options || {};
  if (options.dryRun) {
    return util.format('%s %s', process.execPath, args.join(' '));
  }
  if (options.nodeArgs) {
    debug('node args: %s', options.nodeArgs.join(' '));
    // For example, [--no-warnings]
    args = options.nodeArgs.concat(args);
  }
  debug('Spawn %s %s', process.execPath, args.join(' '));
  const child = spawn(
    process.execPath, // Typically '/usr/local/bin/node'
    args,
    Object.assign(
      {
        stdio: 'inherit',
        env: Object.create(process.env),
      },
      options,
    ),
  );
  child.on('close', (code, signal) => {
    debug('%s exits: %d', cli, code);
    process.exitCode = code;
  });
  return child;
}
/**
 * Run a command with the given arguments
 * @param {string} cli Path of the cli command
 * @param {string[]} args The arguments
 * @param {object} options Options to control dryRun and spawn
 * - nodeArgs An array of args for `node`
 * - dryRun Controls if the cli will be executed or not. If set
 * to true, the command itself will be returned without running it
 */
Run a command with the given arguments
@param {string} cli Path of the cli command
@param {string[]} args The arguments
@param {object} options Options to control dryRun and spawn
- nodeArgs An array of args for `node`
- dryRun Controls if the cli will be executed or not. If set
to true, the command itself will be returned without running it
Run a command with the given arguments @param { string } cli Path of the cli command @param { string [] } args The arguments @param { object } options Options to control dryRun and spawn - nodeArgs An array of args for ` node ` - dryRun Controls if the cli will be executed or not . If set to true the command itself will be returned without running it
function runCLI(cli, args, options) {
  cli = resolveCLI(cli);
  args = [cli].concat(args);
  debug('%s', args.join(' '));
  if (typeof options === 'boolean') options = {dryRun: options};
  options = options || {};
  if (options.dryRun) {
    return util.format('%s %s', process.execPath, args.join(' '));
  }
  if (options.nodeArgs) {
    debug('node args: %s', options.nodeArgs.join(' '));
    args = options.nodeArgs.concat(args);
  }
  debug('Spawn %s %s', process.execPath, args.join(' '));
  const child = spawn(
    process.execPath, 
    args,
    Object.assign(
      {
        stdio: 'inherit',
        env: Object.create(process.env),
      },
      options,
    ),
  );
  child.on('close', (code, signal) => {
    debug('%s exits: %d', cli, code);
    process.exitCode = code;
  });
  return child;
}
function runCLI ( cli , args , options ) { cli = resolveCLI ( cli ) ; args = [ cli ] . concat ( args ) ; debug ( '%s' , args . join ( ' ' ) ) ; if ( typeof options === 'boolean' ) options = { dryRun : options } ; options = options || { } ; if ( options . dryRun ) { return util . format ( '%s %s' , process . execPath , args . join ( ' ' ) ) ; } if ( options . nodeArgs ) { debug ( 'node args: %s' , options . nodeArgs . join ( ' ' ) ) ; args = options . nodeArgs . concat ( args ) ; } debug ( 'Spawn %s %s' , process . execPath , args . join ( ' ' ) ) ; const child = spawn ( process . execPath , args , Object . assign ( { stdio : 'inherit' , env : Object . create ( process . env ) , } , options , ) , ) ; child . on ( 'close' , ( code , signal ) => { debug ( '%s exits: %d' , cli , code ) ; process . exitCode = code ; } ) ; return child ; }
Run a command with the given arguments
 @param {string} cli Path of the cli command
 @param {string[]} args The arguments
 @param {object} options Options to control dryRun and spawn
 - nodeArgs An array of args for `node`
 - dryRun Controls if the cli will be executed or not.
Run a command with the given arguments @param { string } cli Path of the cli command @param { string [] } args The arguments @param { object } options Options to control dryRun and spawn - nodeArgs An array of args for ` node ` - dryRun Controls if the cli will be executed or not .
// Keep it backward compatible as dryRun // For example, [--no-warnings] // Typically '/usr/local/bin/node'