Makes a native call with the specified commands, returning the result.

@param commands The commands separated into individual arguments.
@return Any return values from the command.
494110
public static String nativeCall(final String... commands) {
        LOG.info("Running '{}'", Arrays.asList(commands));
        final ProcessBuilder pb = new ProcessBuilder(commands);
        try {
            final Process process = pb.start();
            final InputStream is = process.getInputStream();
            final String data = IOUtils.toString(is);
            LOG.info("Completed native call: '{}'\nResponse: '"+data+"'", 
                Arrays.asList(commands));
            /*
            final int ev = process.exitValue();
            if (ev != 0) {
                final String msg = "Process not completed normally! " + 
                    Arrays.asList(commands)+" Exited with: "+ev;
                System.err.println(msg);
                LOG.error(msg);
            } else {
                LOG.info("Process completed normally!");
            }
            */
            return data;
        } catch (final IOException e) {
            LOG.error("Error running commands: " + Arrays.asList(commands), e);
            return "";
        }
    }
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
401222
public String call(
      List<String> command,
      @Nullable Path workingDirectory,
      @Nullable Map<String, String> environment)
      throws CommandExitException, CommandExecutionException, InterruptedException {
    ProcessExecutor processExecutor = processExecutorFactory.newProcessExecutor();

    AsyncStreamSaver stdOutSaver = streamSaverFactory.newSaver();
    AsyncStreamSaver stdErrSaver = streamSaverFactory.newSaver();

    try {
      int exitCode =
          processExecutor.run(command, workingDirectory, environment, stdOutSaver, stdErrSaver);
      if (exitCode != 0) {
        String stdOut;
        String stdErr;
        try {
          stdOut = stdOutSaver.getResult().get();
        } catch (InterruptedException ignored) {
          stdOut = "stdout collection interrupted";
        }
        try {
          stdErr = stdErrSaver.getResult().get();
        } catch (InterruptedException ignored) {
          stdErr = "stderr collection interrupted";
        }
        throw new CommandExitException(exitCode, stdOut + "\n" + stdErr);
      }
      return stdOutSaver.getResult().get();
    } catch (IOException | ExecutionException ex) {
      throw new CommandExecutionException(ex);
    }
  }
321052
function getCommands( str ){
	var commands = str.split('|');

	commands.forEach(function( command, key ){
		var args = command.split(':');

		args.forEach(function( arg, k ){
			args[k] = trim( arg );
		});

		commands[key] = {
			command: command,
			method: args.shift(),
			args: args
		};
	});

	return commands;
}
256202
public List getUniqueCommands() {
		List uniqueCommands = new ArrayList();

		for (Iterator it = commands.values().iterator(); it.hasNext();) {
			Command command = (Command) it.next();

			if (!uniqueCommands.contains(command)) {
				uniqueCommands.add(command);
			}
		}

		return uniqueCommands;
	}
583509
public Response execute(Command command) throws IOException {
        for (EventListener temp : listeners) {
            temp.beforeEvent(command);
        }
        Response res = commandExecutor.execute(command);

        for (EventListener temp : listeners) {
            temp.afterEvent(command);
        }

        return res;
    }
581831
public static List<String> constructCommandAsList_Windows_cmd (String command) {
		List<String> commandAsList = new ArrayList<String> ();

		commandAsList.add ("cmd");
		commandAsList.add ("/c");
		commandAsList.add (command);

		return commandAsList;
	}
800195
public void addCommand(Command command) {
        if(command == null)
            throw new IllegalArgumentException();

        if(_frozen)
            throw new IllegalStateException();

        Command[] results = new Command[_commands.length + 1];
        System.arraycopy(_commands, 0, results, 0, _commands.length);
        results[_commands.length] = command;
        _commands = results;
    }
855582
public void runPendingCommands() {
        List<Runnable> commandsToRun = commands;
        commands = new ArrayList<Runnable>();
    
        for (Runnable command: commandsToRun) {
            command.run();
        }
    }
930898
public ProcessExecutor command(Iterable<String> command) {
    List<String> list = new ArrayList<String>();
    Iterator<String> it = command.iterator();
    while (it.hasNext()) {
      list.add(it.next());
    }
    return command(list);
  }
999963
public int exec(Map<String, Command> references) throws Exception
	{
		// System.out.println("in exec() status = " + translateStatus(status) +
		// "...");
		if (status < Command.CHILDREN_PROCESSED)
		{
			if (status < Command.COMMAND_EXECUTED)
			{
				if (status < Command.CHILDREN_FILTERED)
				{
					status = doBeforeRun(references);
					// System.out.println("after doBeforeRun() status = " +
					// translateStatus(status));
				}
				if (status == Command.CHILDREN_FILTERED)
				{
					status = doRun(references);
					// System.out.println("after doRun() status = " +
					// translateStatus(status));
				}
			}
			if (status == Command.COMMAND_EXECUTED)
			{
				status = doAfterRun(references);
				// System.out.println("after doAfterRun() status = " +
				// translateStatus(status));
			}
		}
		// System.out.println("...out of exec() status = " +
		// translateStatus(status));
		return status;
	}
1003094
public String is(final String command) {
		LOG.info("Obtain result from  | " + command + " |");
		return is(command, new String[]{});
	}
1086539
private function alphabetize( $commands )
    {
        $commandList = array_keys($commands);

        sort($commandList, SORT_NATURAL | SORT_FLAG_CASE);

        return array_values($commandList);
    }
1224042
protected function analyseCommands($commands)
    {
        $commandList = [];
        foreach (explode('$', $commands) as $commandLine) {
            $params = explode(',', $commandLine);
            $command = array_shift($params);
            $commandList[] = [
                'command' => $command,
                'params' => $params,
            ];
        }
        return $commandList;
    }
1144579
private int doAfterRun(Map<String, Command> references) throws Exception
	{
		if (status == Command.COMMAND_EXECUTED)
		{
			// System.out.println("doAfterRun(): command " + getResultType() + "
			// processed...");
			Vector<Command> toBeRemoved = new Vector<Command>();
			try
			{
				Statement[] statements = null;

				for (int i = 0; i < operations.size(); ++i)
				{
					Command cmd = operations.elementAt(i);

					if (cmd.isArrayElement())
					{

						if (cmd.isResolved())
						{
							if (statements == null)
							{
								statements = new Statement[operations.size()];
							}
							statements[i] = new Statement(getResultValue(), "set", new Object[] { Integer.valueOf(i), //$NON-NLS-1$
									cmd.getResultValue() });
							if ((i + 1) == operations.size())
							{
								for (int j = 0; j < operations.size(); ++j)
								{
									statements[j].execute();
								}
								toBeRemoved.addAll(operations);
							}
						}
						else
						{
							break;
						}

					}
					else
					{
						// since the call is Array.set()
						if (!isArray())
						{
							cmd.setTarget(getResultValue());
						}
						cmd.exec(references);

						if (cmd.isResolved())
						{
							// System.out.println("doAfterRun(): cmd = " +
							// cmd.methodName + " is resolved");
							toBeRemoved.add(cmd);
						}
						else
						{
							// System.out.println("doAfterRun(): cmd = " +
							// cmd.methodName + " is unresolved");
							break;
						}

					}

				}
			}
			catch (Exception e)
			{
				throw new Exception(e);
			}
			finally
			{
				operations.removeAll(toBeRemoved);
			}

			// if (operations.size() == 0) {
			// System.out.println("doAfterRun(): command " + getResultType()
			// + " completely processed.");
			// } else {
			// System.out.println("doAfterRun(): command " + getResultType()
			// + " contains incomplete " +
			// operations.size() + " commands.");
			// }
			return (operations.size() == 0) ? Command.CHILDREN_PROCESSED : status;
		}
		return status;
	}
19568
public static void executeSQL(final SQLiteDatabase database, List<String> commands) {
		for (String command : commands) {
			executeSQL(database, command);
		}
		// commands.forEach(command -> {
		// executeSQL(database, command);
		// });
	}
1349550
@Override
    public byte[] serialize(final List<Command> commands) {
        final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        final Output output = new Output(outStream);
        kryo.get().writeObject(output, commands);
        output.close();
        byte[] bytes = outStream.toByteArray();
        try {
            outStream.close();
        } catch (IOException e) {
            // This will not happen, as there is no real I/O. Everything happens in RAM.
            e.printStackTrace();
        }
        return bytes;
    }