Process the command.

@param command
A String list containing the command to be executed.
14149
private void processCommand(List<String> command) throws Exception {
        processBuilder.command(command);
        Process p = processBuilder.start();
        checkReturnCode(p, processBuilder.command().toString(), 0);
    }
1336389
@Override
    public boolean handles(String command) {
        if (command.startsWith(this.tree.getTopNode().getData())) {
            return true;
        }
        return false;
    }
1229919
public void runCommand(String command) throws Exception {
        String result = "";
        String extras = "export PYTHONWARNINGS=\"ignore:Unverified HTTPS request\" && ";

        Channel channel = session.openChannel("exec");
        ((ChannelExec) channel).setCommand(extras + command);

        channel.setInputStream(null);
        ((ChannelExec) channel).setErrStream(System.err);

        InputStream in = channel.getInputStream();

        ((ChannelExec) channel).setPty(true);

        channel.connect();

        byte[] tmp = new byte[1024];
        while (true) {
            while (in.available() > 0) {
                int i = in.read(tmp, 0, 1024);
                if (i < 0) {
                    break;
                }
                result = result + new String(tmp, 0, i);
            }
            this.result = result;
            this.setResult(result);

            if (channel.isClosed()) {
                if (in.available() > 0) {
                    continue;
                }
                this.exitStatus = channel.getExitStatus();
                break;
            }
            try {
                Thread.sleep(1000);
            } catch (Exception ee) {
            }
        }

        channel.disconnect();
    }
233457
private synchronized void submit(final String command) {
    LOG.log(Level.INFO, "Submit command {0} to {1} evaluators. state: {2}",
        new Object[]{command, this.contexts.size(), this.state});
    assert this.state == State.READY;
    this.expectCount = this.contexts.size();
    this.state = State.WAIT_TASKS;
    this.cmd = null;
    for (final ActiveContext context : this.contexts.values()) {
      this.submit(context, command);
    }
  }
905982
public static String execute(final boolean withResponse, final String... command)
		throws IOException
	{
		final List<String> commands = new ArrayList<>();
		commands.add("bash");
		commands.add("-c");
		commands.addAll(Arrays.asList(command));
		String response = "";

		final ProcessBuilder pb = new ProcessBuilder(commands);
		pb.redirectErrorStream(true);

		final Process shell = pb.start();

		if (withResponse)
		{
			try (InputStream shellIn = shell.getInputStream())
			{
				response = toString(shellIn);
			}
		}

		return response;
	}
984784
public void doForward(String command)
	{
		if (command != null)
			if (command.startsWith("#"))
				command = command.substring(1);
		Util.getLogger().info("Browser forward: java browser command=" + command + " = target: " + this.cleanCommand(command));
 		BaseApplet.handleAction(this.cleanCommand(command), this, this, Constants.DONT_PUSH_TO_BROWSER);
	}
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);
  }
855582
public void runPendingCommands() {
        List<Runnable> commandsToRun = commands;
        commands = new ArrayList<Runnable>();
    
        for (Runnable command: commandsToRun) {
            command.run();
        }
    }
28311
protected Pair<Integer, InputStream> executeCommand(String command) {
        int resultVal = 1;
        InputStream inputStream = null;
        try {
            logger.debug("Executing command: {}", command);
            Process process =  Runtime.getRuntime().exec(command);

            resultVal = process.waitFor();
            inputStream = process.getInputStream();

        } catch (InterruptedException e) {
            logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage());
            Thread.currentThread().interrupt();
        } catch (IOException  e) {
            logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage());
        }
        if (inputStream == null) {
           // Create an empty InputStream instead of returning a null
           inputStream = new InputStream() {
               @Override
               public int read() throws IOException {
                   return -1;
               }
           } ;
        }
        return new Pair<>(resultVal, inputStream);
    }
128372
private static String executePowerShellCommand(String command) {
        try {
            String[] commandList = {POWER_SHELL, POWER_SHELL_COMMAND, command};
            ProcessBuilder pb = new ProcessBuilder(commandList);
            Process process = pb.start();

            InputStream is = process.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);

            String line;
            while ((line = br.readLine()) != null) {
                if (line.startsWith(COMMON_NAME_PARAMETER)) {
                    String[] values = line.split(COMMA_SPLIT);
                    return values[0].substring(values[0].indexOf(EQUAL_SPLIT) + 1);
                }
            }
        } catch (Exception e) {
            // do nothing
        }
        return null;
    }
1090467
@Override
    public boolean sendCommand(String command) {
        try {
            sendCommand2(command);
        } catch (Exception ex) {
            logger.error("Could not run command " + command, ex);
            return false;
        }
        return true;
    }
165845
public synchronized void execute(Runnable command) {
        if (active.get()) {
            stop();
            this.command = command;
            start();
        } else {
            this.command = command;
        }
    }
402116
public void executeOnDaemon(Runnable command) {

        int id = 0;
        final Runnable commandToRun = command;

        synchronized (this) {
            this.daemonId++;
            id = this.daemonId;
        }

        final String runId = name + " : DMN" + id; // d185137.2

        Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction()
        { // d185137.2
            public Object run()
        {
            // return new Thread(commandToRun); // d185137.2
            Thread temp = new Thread(commandToRun, runId); // d185137.2
            temp.setDaemon(true);
            return temp;
        }
        });
        t.start();
    }
765551
protected void fireCommandRegistered(AbstractCommand command) {
        
        Assert.notNull(command, "command");
        
        if (commandRegistryListeners.isEmpty()) {
            return;
        }
        
        CommandRegistryEvent event = new CommandRegistryEvent(this, command);
        
        for (Iterator i = commandRegistryListeners.iterator(); i.hasNext();) {
            ((CommandRegistryListener)i.next()).commandRegistered(event);
        }
        
    }
1365839
protected function execute($command)
    {
        $process = new Process($command);
        $process->setTimeout(null);
        $process->run();

        if (!$process->isSuccessful()) {
            throw new \RuntimeException($process->getErrorOutput());
        }
    }
203343
public static String command(Command command) throws Exception {
        // Check Service
        if (!IS_BIND)
            bindService();

        // Return
        try {
            return commandRun(command);
        } catch (Exception e) {
            e.printStackTrace();
            restart();
            throw e;
        }
    }
285949
protected void handleProcessTimeout(String[] cmd) throws IOException {
        StringBuilder bld   = new StringBuilder();
        boolean       first = true;
        for (String c : cmd) {
            if (first) {
                first = false;
            } else {
                bld.append(" ");
            }

            String esc = Strings.escape(c);

            // Quote where escaping is needed, OR the argument
            // contains a literal space.
            if (!c.equals(esc) || c.contains(" ")) {
                bld.append('\"')
                   .append(esc)
                   .append('\"');
            } else {
                bld.append(c);
            }
        }

        throw new IOException("Process took too long: " + bld.toString());
    }