Experimental version of run propagates error messages to client. This command will be default "run" eventually
420953
def _run_with_output_on_failure(self, cmd, non_blocking=False,
                                  ignore_errors=False,
                                  max_wait_sec=365 * 24 * 3600,
                                  check_interval=0.2) -> str:
    """"""

    if not self._can_run:
      assert False, "Using .run before initialization finished"

    if '\n' in cmd:
      assert False, "Don't support multi-line for run2"

    cmd = cmd.strip()
    if cmd.startswith('#'):  # ignore empty/commented out lines
      return ''
    self.run_counter += 1
    self.log("tmux> %s", cmd)

    self._cmd = cmd
    self._cmd_fn = f'{self.remote_scratch}/{self.run_counter}.cmd'
    self._status_fn = f'{self.remote_scratch}/{self.run_counter}.status'
    self._out_fn = f'{self.remote_scratch}/{self.run_counter}.out'

    cmd = util.shell_strip_comment(cmd)
    assert '&' not in cmd, f"cmd {cmd} contains &, that breaks things"

    # modify command to dump shell success status into file
    self.file_write(self._cmd_fn, cmd + '\n')

    #    modified_cmd = f'{cmd} > {out_fn} 2>&1; echo $? > {status_fn}'
    # https://stackoverflow.com/a/692407/419116
    # $cmd > >(tee -a fn) 2> >(tee -a fn >&2)

    modified_cmd = f'{cmd} > >(tee -a {self._out_fn}) 2> >(tee -a {self._out_fn} >&2); echo $? > {self._status_fn}'
    modified_cmd = shlex.quote(modified_cmd)

    start_time = time.time()
    tmux_window = self.tmux_session + ':' + str(self.tmux_window_id)
    tmux_cmd = f"tmux send-keys -t {tmux_window} {modified_cmd} Enter"
    self._run_raw(tmux_cmd, ignore_errors=ignore_errors)
    if non_blocking:
      return 0

    if not self.wait_for_file(self._status_fn, max_wait_sec=60):
      self.log(f"Retrying waiting for {self._status_fn}")
    elapsed_time = time.time() - start_time
    while not self.exists(self._status_fn) and elapsed_time < max_wait_sec:
      self.log(f"Still waiting for {cmd}")
      self.wait_for_file(self._status_fn, max_wait_sec=60)
      elapsed_time = time.time() - start_time
    contents = self.read(self._status_fn)

    # if empty wait a bit to allow for race condition
    if len(contents) == 0:
      time.sleep(check_interval)
      contents = self.read(self._status_fn)
    status = int(contents.strip())
    self.last_status = status

    if status != 0:
      extra_msg = '(ignoring error)' if ignore_errors else '(failing)'
      self.log(
        f"Start failing output {extra_msg}: \n{'*'*80}\n\n '{self.read(self._out_fn)}'")
      self.log(f"\n{'*'*80}\nEnd failing output")
      if not ignore_errors:
        raise RuntimeError(f"Command {cmd} returned status {status}")
      else:
        self.log(f"Warning: command {cmd} returned status {status}")

    return self.read(self._out_fn)
645606
function error () {
  if (mocking) {
    cli.stderr += stripAnsi(concatArguments(arguments) + '\n')
  } else {
    console.error.apply(null, arguments)
  }
}
587097
function runCmd(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, {}, function(err, stdout) {
      if(err) {
        console.error(stdout);
        return reject(err);
      }

      return resolve(stdout);
    });
  });
}
1170210
function run(params, command, callback)
{
  var job;

  // decouple commands
  command = clone(command);

  // start command execution and get job reference
  job = executioner(command, stringify(extend(this, params)), this.options || {}, callback);

  // make ready to call task termination function
  return partial(executioner.terminate, job);
}
590543
def run_command(*cmd, **kwargs):
    ''
    logging.debug('Running: {0} with {1}'.format(cmd, kwargs))
    kwargs['stdout'] = sys.stderr
    subprocess.check_call(cmd, **kwargs)
1180539
def main():
    
    args = _parse_args()
    _init_logging(args.verbose)
    client = _from_args(args)
    client.submit_error(args.description, args.extra,
                        default_message=args.default_message)
169560
def execute(argv, filename='Runfile')
      @ignore_settings = !filename
      argv = expand_shortcuts argv
      filename and File.file?(filename) or handle_no_runfile argv

      begin
        load settings.helper if settings.helper
        load filename
      rescue => ex
        abort "Runfile error:\n#{ex.message}\n#{ex.backtrace[0]}"
      end
      run(*argv)
    end
21904
def run_command(self, command_name, config_updates=None,
                    named_configs=(), args=(), meta_info=None):
        
        import warnings
        warnings.warn("run_command is deprecated. Use run instead",
                      DeprecationWarning)
        return self.run(command_name, config_updates, named_configs, meta_info,
                        args)
1043013
def run(self, argv):
        """"""
        command = argv[0]
        handlers = { 
            'clean': self.clean,
            'create': self.create,
            'disable': self.disable,
            'enable': self.enable,
            'list': self.list,
            'update': self.update,
        }
        handler = handlers.get(command, None)
        if handler is None:
            error("Unrecognized command: %s" % command, 2)
        handler(argv[1:])
1193043
def run(cmd, data=None, checks=None, region=None, log_error=True,
        log_stdout=False):
    
    try:
        logger.debug(" ".join(str(x) for x in cmd) if not isinstance(cmd, basestring) else cmd)
        _do_run(cmd, checks, log_stdout)
    except:
        if log_error:
            logger.info("error at command")
        raise
664267
def _exec_command(self, cmd):
        
        _, out, err = self._client.exec_command(cmd, timeout=self._timeout)
        return out.read().strip() if not err.read().strip() else None
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));
    });
}
1032147
def runCommands(self,commands,args):
        
        errorCounter = 0
        if args.list:
            print '\n'.join(commands)
        else:
            # Each command is executed sequentially:
            for command in commands:
                process = subprocess.Popen(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
                stream = process.communicate()
                output = stream[0]
                erroroutput = stream[1]
                returncode = process.returncode
                if args.verbose:
                    print 'Executing command: '+command
                if returncode != 0:
                    errorCounter = errorCounter + 1
                    if args.verbose or not args.ignore_errors:
                        print 'An error occurred:\n'
                        print erroroutput
                    if not args.ignore_errors:
                        print('Terminating map process.')
                        break
                if returncode == 0 and len(output) > 0:
                    sys.stdout.write(output)
        if args.verbose:
            print 'Process completed successfully.'
            if errorCounter > 0:
                if errorCounter > 1:
                    print str(errorCounter) + ' errors occurred during the process.'
                else:
                    print str(errorCounter) + ' error occurred during the process.'
232542
function invokeCommandError(command, isInternalCommand) {

  if (isInternalCommand) {
    return;
  }

  const cwd = process.cwd();
  logger.error(`No modules found for ${command}`);

  if (cwd.indexOf('skyux-spa') === -1) {
    logger.error(`Are you in a SKY UX SPA directory?`);
  } else if (!fs.existsSync('./node_modules')) {
    logger.error(`Have you ran 'npm install'?`);
  }

  process.exit(1);
}
1312848
def run(ctx, commandline):
    """"""
    file = ctx.obj['FILE']
    dotenv_as_dict = dotenv_values(file)
    if not commandline:
        click.echo('No command given.')
        exit(1)
    ret = run_command(commandline, dotenv_as_dict)
    exit(ret)
788225
def run_cmd(cmd, out=os.path.devnull, err=os.path.devnull):
    

    logger.debug(' '.join(cmd))
    with open(out, 'w') as hout:
        proc = subprocess.Popen(cmd, stdout=hout, stderr=subprocess.PIPE)
        err_msg = proc.communicate()[1].decode()
    with open(err, 'w') as herr:
        herr.write(str(err_msg))
    msg = '({}) {}'.format(' '.join(cmd), err_msg)
    if proc.returncode != 0:
        logger.error(msg)
        raise RuntimeError(msg)
47063
function run(command, auth, options, async, done, msgSuccess, msgSuccessAsync, msgFailure) {

        var args,
            flags,
            field,
            i,
            childProcess;

        // Pass auth.
        command = command.replace('{auth}', auth ? format('--email=%s --passin ', auth.email) : '');

        // Evaluate arguments to pass.
        args = '';
        for (field in options.args) {
            args += format('--%s=%s ', field, options.args[field]);
        }

        // Evaluate flags to pass.
        flags = '';
        for (i = 0; i < options.flags.length; ++i) {
            flags += format('--%s ', options.flags[i]);
        }

        command = command.replace('{args}', args).replace('{flags}', flags).replace('{path}', options.path);

        // Passin.
        if (auth) {
            command = format('echo %s | %s', auth.password, command);
        }

        // Run it asynchronously
        if (async) {
            command = COMMAND_ASYNC.
                replace('{command}', command).
                replace('{redirect}', options.asyncOutput ? '' : REDIRECT_DEVNULL);
        }

        grunt.log.debug(command);

        // Run the command.
        childProcess = exec(command, {}, function () {});

        // Listen to output
        if (options.stdout) {
            childProcess.stdout.on('data', function (d) {
                grunt.log.write(d);
            });
        }

        // Listen to errors.
        if (options.stderr) {
            childProcess.stderr.on('data', function (d) {
                grunt.log.error(d);
            });
        }

        // Listen to exit.
        childProcess.on('exit', function (code) {
            if (options.stdout) {
                if (code === 0 && async) {
                    grunt.log.subhead(
                        msgSuccessAsync ||
                        options.asyncOutput && 'Output from asynchronous operation follows.' ||
                        'Unable to determine success of asynchronous operation. For debugging please disable async mode or enable asyncOutput.'
                    );
                } else if (code === 0) {
                    grunt.log.ok(msgSuccess || 'Action executed successfully.');
                }
            }

            if (options.stderr && code !== 0) {
                grunt.log.error(msgFailure || 'Error executing the action.');
            }

            done();
        });

    }