Process opearation and create respective command arguments
181890
protected function processOperation()
    {
        if ($this->_operation!==null) {
            $value = $this->_operationArgument ? $this->_operationArgument : null;
            if ($value instanceof TmpFile) {
                $value = (string) $value;
            }
            $this->addArg($this->_operation, $value, $this->_escapeOperationArgument);
        }
    }
539336
def call(cmd, input_file=None, input_text=None, encoding=None):
    """"""

    process = get_process(cmd)

    if input_file is not None:
        with open(input_file, 'rb') as f:
            process.stdin.write(f.read())
    if input_text is not None:
        process.stdin.write(input_text)

    return get_process_output(process, encoding)
614469
def run(self, params):
        

        self.params = list(reversed(params))

        if not self.params:
            self.help()
            return

        while self.params:
            p = self.params.pop()

            if p in self.command:
                # If we got a known command, execute it.
                self.command[p](self)

            elif os.path.exists(p):
                # If we were given the name of an existing file, read it.
                self.read_moc(p)

            else:
                # Otherwise raise an error.
                raise CommandError('file or command {0} not found'.format(p))
912739
function(options) {
		var program = new Commander();
		if (options) {
			//hack to emulate process.argv
			options.unshift('', '');
		}
		//process short command names
		var args = options || process.argv.slice();
		var command = args[2];
		var validCommand = config.aliases[command];

		if (validCommand) {
			args[2] = validCommand;
		}
		program.parse(args);
	}
530260
function main (processArgv, conf) {

  // CLI input
  var opts = getOpts(processArgv);
  var argv = opts.argv;

  // Update notifier
  if (!argv["no-notifier"]) {
    checkUpdate();
  }

  // Convert options "--help" and "-h" into command "help"
  if (argv.help) {
    processArgv = transformHelpArgs(processArgv);
    // Regenerate opts from newly forged process.argv
    opts = getOpts(processArgv);
    argv = opts.argv;
  }

  // "--version"
  if (argv.version) {
    showVersion();
  }

  var commandName = argv._[0];

  // Demand command name
  if (!commandName) {
    console.error("No command specified");
    opts.showHelp();
    process.exit(127);
  }

  // Load command module
  var command = commands.load(commandName);

  // Demand valid command
  if (!command) {
    console.error("Unknown command: " + commandName);
    opts.showHelp();
    process.exit(127);
  }

  process.on("exit", function () {
    ttys.stdin.end();
  });

  // Configure opts and run command (inside a domain to catch any error)
  commands.run(command, opts, conf).then(ok, fail);

  function ok () {
    process.exit(0);
  }

  function fail (e) {
    if (e.code === "EINTERRUPT") {
      process.exit(127);
    } else {
      console.error("%s", e);
      if (process.env.DEBUG) {
        throw e;
      }
      process.exit(1);
    }
  }
}
756123
function runCommand(cmd, args, cb) {

	// set locale so we can be sure of consistency of command execution
	const env = extend(process.env, { LANG: 'en', LC_ALL: 'en', LC_MESSAGES: 'en' });

	const argArray = Array.isArray(args) ? args : args.split(' ');

	const s = spawn(cmd, argArray, {
		stdio: ['ignore', 'pipe', 'pipe'],
		env
	});

	let stdout = '';
	s.stdout.on('data', (data) => {
		stdout += data;
	});

	let stderr = '';
	s.stderr.on('data', (data) => {
		stderr += data;
	});

	s.on('error', (error) => {
		cb(error, null, stdout, stderr);
	});

	s.on('close', (code) => {
		cb(null, code, stdout, stderr);
	});
}
102029
def run_from_argv(self, prog, subcommand, global_options, argv):
        
        self.prog_name = prog
        parser = self.create_parser(prog, subcommand)
        options, args = parser.parse_args(argv)
        self.global_options = global_options
        self.options = options
        self.args = args
        self.execute(args, options, global_options)
792292
function buildSpawn (cmd, args, opts, callback) {
  var proc = spawn(cmd, args, opts)
  var buffer = new Buffer('')
  var cmdError = {}

  cmd = cmd + ' ' + args.join(' ')

  if (proc.stdout) {
    proc.stdout.on('data', function indexOnData (data) {
      buffer = Buffer.concat([buffer, data])
    })
  }

  proc
    .on('error', function spawnOnError (err) {
      cmdError = new CommandError({
        command: cmd,
        message: err.message ? err.message : undefined,
        stack: err.stack ? err.stack : undefined,
        buffer: buffer ? buffer : undefined,
        status: err.status ? err.status : 1
      })
    })
    .on('close', function spawnOnClose (code) {
      if (code === 0) {
        callback(null, buffer.toString().trim(), code, buffer)
        return
      }

      cmdError = new CommandError({
        command: cmd,
        message: cmdError.message ? cmdError.message : undefined,
        stack: cmdError.stack ? cmdError.stack : undefined,
        buffer: cmdError.buffer ? cmdError.buffer : buffer,
        status: cmdError.status ? cmdError.status : code
      })
      callback(cmdError, undefined, code, undefined)
    })

  return proc
}
254595
def buildCommand(self,fileName,count,args):
        
        # Escape all placeholders in the file path:
	fileNameWithPath = self.escapePlaceholders(fileName)

        # The command is split into 'parts', which are separated by blank spaces:
        commandParts = args.command.split(' ')
        processedParts = []
        # Each part of the command is processed separately:
        for part in commandParts:
            processedParts.append(self.buildPart(part,fileNameWithPath,count,args))
        # The parts are put together at the end and the new command is returned:
        return self.unescapePlaceholders(' '.join(processedParts))
1045033
def _process_commands(self, commands):
        """"""
        if commands is None:
            return
        for cmd_list in commands:
            try:
                cmd_list = split_command_line(cmd_list)
                cmd = cmd_list[0]
                if cmd == 'gdb_port':
                    if len(cmd_list) < 2:
                        LOG.error("Missing port argument")
                    else:
                        self._args.port_number = int(cmd_list[1], base=0)
                elif cmd == 'telnet_port':
                    if len(cmd_list) < 2:
                        LOG.error("Missing port argument")
                    else:
                        self._args.telnet_port = int(cmd_list[1], base=0)
                elif cmd == 'echo':
                    self.echo_msg = ' '.join(cmd_list[1:])
                else:
                    LOG.error("Unsupported command: %s" % ' '.join(cmd_list))
            except IndexError:
                pass
1344541
def execute_command(self, cmnd, *args, **options):
        ""
        args, options = self.preprocess_command(cmnd, *args, **options)
        return self.client.execute_command(cmnd, *args, **options)
870703
function exec(cmd, args, options) {
    // If true user wants stdout to output value
    // instead of using inherit outputting
    // to process.stdout stream.
    if (options === true)
        options = { stdio: 'pipe' };
    options = chek_1.extend({}, spawnDefaults, options);
    if (chek_1.isString(args))
        args = argv_1.splitArgs(args);
    // Ensure command and arguments.
    if (!cmd)
        logger_1.log.error('Cannot execute process with command of undefined.');
    args = args.map(function (s) {
        if (/\s/g.test(s))
            return '"' + s + '"';
        return s;
    });
    // Spawn child.
    var child = child_process_1.spawnSync(cmd, args, options);
    if (child.stdout)
        return child.stdout.toString();
}
426918
def add_arguments(self, parser):
        '''

        '''
        commands = set(name[3:] for name in dir(self) if name.startswith('do_'))
        parser.add_argument('action', help='action to run', nargs='?',
                            choices=list(commands))
        parser.add_argument('arguments', help='arguments specific to ACTION',
                            nargs=argparse.REMAINDER)
92765
def execute(command_line)
      result = collect_result(command_line, *spawn_process(command_line))
      result.wait
      result
    end
816819
def run_from_argv(self, prog, subcommand, global_options, argv):
        
        self.prog_name = prog
        if self.skip_options:
            parser = NewOptionParser(prog=self.prog_name,
                     usage=self.usage(subcommand),
                    version='',
                    formatter = NewFormatter(),
                     add_help_option = False,
                     option_list=self.option_list)
        else:
            parser = self.create_parser(prog, subcommand)
        options, args = parser.parse_args(argv)
        self.execute(args, options, global_options)
1046965
def do_windowed(self, arg):
        
        if self.cmdprefix:
            raise CmdError("prefix not allowed")
        cmdline = self.input_command_line(arg)
        try:
            process = self.debug.execl(arg,
                                                bConsole = False,
                                                 bFollow = self.options.follow)
            print("Spawned process (%d)" % process.get_pid())
        except Exception:
            raise CmdError("can't execute")
        self.set_fake_last_event(process)
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.'