use launchProcess to execute a command

@param command command to be executed
@throws ExecuteException
@throws IOException
777388
public static void exec_command(String command) throws IOException {
        launchProcess(command, new HashMap<String, String>(), false);
    }
1159163
public final void start(final Command command, final Callback callback) {
        this.start = System.currentTimeMillis();
        this.conditionSatisfied = false;
        command.execute();
        new Async().whilst(new KeepGoing(), new Finish(callback), checker(), 500);
    }
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;
    }
449686
protected function execute($command)
    {
        $process = proc_open($command, array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
        fclose($pipes[2]);
        $this->output = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        $status = proc_get_status($process);
        $this->status = $status['exitcode'];
        proc_close($process);
    }
153577
public static Runnable apply(final Runnable command, final EventExecutor eventExecutor) {
        ObjectUtil.checkNotNull(command, "command");
        ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
        return new Runnable() {
            @Override
            public void run() {
                setCurrentEventExecutor(eventExecutor);
                try {
                    command.run();
                } finally {
                    setCurrentEventExecutor(null);
                }
            }
        };
    }
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);
    }
1330263
protected void doExecuteCommand() {
        if (this.commandExecutor instanceof ParameterizableActionCommandExecutor) {
            ((ParameterizableActionCommandExecutor) this.commandExecutor).execute(getParameters());
        }
        else {
        	if (this.commandExecutor != null) {
        		this.commandExecutor.execute();
        	}
        }
    }
334591
public PowerShellResponse executeCommand(String command) {
        String commandOutput = "";
        boolean isError = false;
        boolean timeout = false;

        checkState();

        PowerShellCommandProcessor commandProcessor = new PowerShellCommandProcessor("standard", p.getInputStream(),
                this.waitPause, this.scriptMode);
        Future<String> result = threadpool.submit(commandProcessor);

        // Launch command
        commandWriter.println(command);

        try {
            if (!result.isDone()) {
                try {
                    commandOutput = result.get(maxWait, TimeUnit.MILLISECONDS);
                } catch (TimeoutException timeoutEx) {
                    timeout = true;
                    isError = true;
                    //Interrupt command after timeout
                    result.cancel(true);
                }
            }
        } catch (InterruptedException | ExecutionException ex) {
            logger.log(Level.SEVERE,
                    "Unexpected error when processing PowerShell command", ex);
            isError = true;
        } finally {
            // issue #2. Close and cancel processors/threads - Thanks to r4lly
            // for helping me here
            commandProcessor.close();
        }

        return new PowerShellResponse(isError, commandOutput, timeout);
    }
690242
public ProcessInfo execute(boolean background,String...  command)
	{
		 ProcessBuilder pb = new ProcessBuilder(command);

		 
		return executeProcess(background,pb);
		
	}
754351
public String executeCommandOnServlet(String command) {
    try {
      return getCommandResponseAsString(command);
    } catch (IOException e) {
      if (e instanceof ConnectException) {
        throw new SeleniumException(e.getMessage(), e);
      }
      e.printStackTrace();
      throw new UnsupportedOperationException("Catch body broken: IOException from " + command +
          " -> " + e, e);
    }
  }
1370207
@Override
    public void execute(Runnable command)
    {
        super.execute(isTracing() && !(command instanceof TraceSessionWrapper)
                      ? new TraceSessionWrapper<Object>(Executors.callable(command, null))
                      : command);
    }
530107
static function executeCommand($command)
    {
        exec($command, $output, $resultCode);

        if ($resultCode > 0) {
            $output = implode("\n", $output);
            throw new Exception("Failed to execute command: '$command' with output: '$output' ");
        }
    }
165845
public synchronized void execute(Runnable command) {
        if (active.get()) {
            stop();
            this.command = command;
            start();
        } else {
            this.command = 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;
	}
1224681
private static Process startProcess( String[] exec )
        throws IOException
    {
        Process process = Runtime.getRuntime().exec( exec );
        return process;
    }
755998
public void run(
      List<String> command,
      @Nullable Path workingDirectory,
      @Nullable Map<String, String> environment,
      ConsoleListener consoleListener)
      throws InterruptedException, CommandExitException, CommandExecutionException {
    ProcessExecutor processExecutor = processExecutorFactory.newProcessExecutor();
    try {
      int exitCode =
          processExecutor.run(
              command,
              workingDirectory,
              environment,
              streamHandlerFactory.newHandler(consoleListener),
              streamHandlerFactory.newHandler(consoleListener));
      if (exitCode != 0) {
        throw new CommandExitException(exitCode);
      }
    } catch (IOException ex) {
      throw new CommandExecutionException(ex);
    }
  }
85144
protected static String runCommand(String... command) {
		try {
			final Process p = Runtime.getRuntime().exec(command);
			if (p == null) {
				return null;
			}
			final StringBuilder bStr = new StringBuilder();
			try (InputStream standardOutput = p.getInputStream()) {
				final byte[] buffer = new byte[BUFFER_SIZE];
				int len;
				while ((len = standardOutput.read(buffer)) > 0) {
					bStr.append(new String(buffer, 0, len));
				}
				p.waitFor();
				return bStr.toString();
			}
		} catch (Exception e) {
			return null;
		}
	}