Executes the given command via shell and returns the complete output as
a string

@param string $command

@return array(status, stdout, stderr)
556952
protected function executeCommand($command)
    {

        $process = new Process($command);
        $process->run();

        return array(
            $process->getExitCode(),
            $process->getOutput(),
            $process->getErrorOutput(),
        );
    }
1020056
public function execute($command) {
    /** @var \Robo\Common\ProcessExecutor $process_executor */
    $process_executor = Robo::process(new Process($command));
    return $process_executor->dir($this->getConfigValue('repo.root'))
      ->printOutput(FALSE)
      ->printMetadata(FALSE)
      ->interactive(FALSE);
  }
977055
protected function _execute($command) {
		try {
			if (!$class = $this->_instance($command)) {
				return false;
			}
		} catch (ClassNotFoundException $e) {
			return false;
		}
		$data = [];
		$params = $class->invokeMethod('_params');

		foreach ($params as $param) {
			$data[$param] = $class->invokeMethod("_{$param}", [$this->request]);
		}

		if ($message = $class->invokeMethod('_save', [$data])) {
			$this->out($message);
			return true;
		}
		return false;
	}
172215
private function exec($command, $background = false) {

		exec(escapeshellcmd($command) . ($background === true ?  ' > /dev/null &' : ''), $output);

		return $output;
	}
92489
protected function exec($command, array $arguments = array())
    {
        $command = $this->bin . ' ' . $command;

        $commandline = $this->cli->prepare($command, $arguments);

        if ($this->cli->execute($commandline) <> 0) {
            throw new ProcessFailedException($this->cli->getProcess());
        } elseif ($message = $this->cli->getErrorOutput()) {
            throw new \RuntimeException($message);
        }

        return $this->cli->getOutput();
    }
321447
public function exec($command)
    {
        // run command
        $exit = -1;
        $logfile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tika-error.log';
        $descriptors = [['pipe', 'r'], ['pipe', 'w'], ['file', $logfile, 'a']];
        $process = proc_open($command, $descriptors, $pipes);
        $callback = $this->callback;

        // get output if command runs ok
        if(is_resource($process))
        {
            fclose($pipes[0]);
            $this->response = '';
            while($chunk = stream_get_line($pipes[1], $this->chunkSize))
            {
                if(!is_null($callback))
                {
                    $callback($chunk);
                }

                $this->response .= $chunk;
            }
            fclose($pipes[1]);
            $exit = proc_close($process);
        }

        // exception if exit value is not zero
        if($exit > 0)
        {
            throw new Exception("Unexpected exit value ($exit) for command $command");
        }

        return trim($this->response);
    }
1123938
private function getCommandString($command, array $arguments)
    {
        $list = array();
        $this->flatten($arguments, $list);

        return trim(strtoupper($command).' '.implode(' ', $list));
    }
1086162
public function execute(Command $command)
    {
        if ($this->locked === true) {
            $this->queue[] = $command;
            return null;
        }

        $this->locked = true;

        $response = $this->executeIgnoringLock($command);

        $this->executeQueue();

        $this->locked = false;

        return $response;
    }
608840
public function executeAdbShellCommand($command)
    {
        return $this->getDriver()->curl(
            $this->getDriver()->factoryCommand(
                'selendroid/adb/executeShellCommand',
                \WebDriver_Command::METHOD_POST,
                ['command' => $command]
            )
        );
    }
987635
private function _run($command) 
	{
		if ($this->options['type'] === self::TYPE_PHP) {
			// Old Option: Run direct from terminal (doesn't like brackets too much).
			// $cmd = "php -r \"{$command}\"";

			// New Option: Save to temp file & run it.
			$this->savedFiles[] = $this->options['tmp-dir'] . 'async-tmp-' . time() . '.php';
			$result = file_put_contents(
				end($this->savedFiles),
				$this->_generateCode($command),
				LOCK_EX
			);

			if ($result !== false) {
				$cmd = "php " . end($this->savedFiles);
			}
			else {
				$cmd = "php --help";
			}
		}
		else {
			$cmd = $command;
		}

		if ($this->options['async']) {
			// This forks the process.
			// Helpful guide @ https://segment.com/blog/how-to-make-async-requests-in-php/
			$cmd .= ' > /dev/null 2>&1 &';
		}

		exec($cmd, $output, $exit);

		if ($this->options['debug']) {
			echo '<br />Command Run: ' . $cmd;
		}

		return $exit === 0;
	}
231964
protected function run($command, $standardInput = null)
    {
        $stdOut = '';
        $stdErr = '';
        $stdOut = array();
        $rc = $this->processExecutor->execute($command, $stdOut);
        $stdOut = (string) $stdOut;
        $stdErr = (string) $this->processExecutor->getErrorOutput();

        return array($rc, $stdOut, $stdErr);
    }
81631
protected function doAction(Command $command)
    {
        if ($command->name() === '__default__') {
            return $this->notFound();
        }

        // Let the command collect more data (if missing or needs confirmation)
        $command->interact($this->io());

        if (!$command->action() && !\method_exists($command, 'execute')) {
            return;
        }

        $params = [];
        $values = $command->values();
        // We prioritize action to be in line with commander.js!
        $action = $command->action() ?? [$command, 'execute'];

        foreach ($this->getActionParameters($action) as $param) {
            $params[] = $values[$param->getName()] ?? null;
        }

        return $action(...$params);
    }
992472
public function aExecuteCommandTo($command) {
        $this->restartKernel();
        $kernel = $this->getKernel();

        $application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
        $application->setAutoExit(false);

        $exploded = explode(" ", $command);

        $commandsParams = [
        ];
        foreach ($exploded as $value) {
            if (!isset($commandsParams["command"])) {
                $commandsParams["command"] = $value;
            } else {
                $e2 = explode("=", $value);
//                var_dump($e2);
                if (count($e2) == 1) {
                    $commandsParams[] = $e2[0];
                } else if (count($e2) == 2) {
                    $commandsParams[$e2[0]] = $e2[1];
                }
            }
        }
        foreach ($commandsParams as $key => $value) {
            $commandsParams[$key] = $value;
        }
        $input = new \Symfony\Component\Console\Input\ArrayInput($commandsParams);
        if ($output === null) {
            $output = new \Symfony\Component\Console\Output\ConsoleOutput();
        }
        $application->run($input, $output);
//         $content = $output->fetch();
    }
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);
    }
584392
public function executeCommand(Command $command)
    {
        if ($command instanceof DsnDependent) {
            $command->setDsn($this->dsn);
        }

        $shellCmd = self::VTCTLD_EXECUTABLE . ' ' . $this->getServerString() . ' '
             . $command->getName() . ' ' . implode(' ', $command->getParams());

        exec($shellCmd, $output, $return);
        $output = implode("\n", $output);

        if ($return !== 0) {
            throw new Exception('Error running vtctld command - ' . $shellCmd . ', error: ' . $output);
        }

        $resultClass = $command->getResultClass();

        return new $resultClass($this->dsn, $output);
    }
49604
private function execute(Command $command)
    {
        $exec = $this->exec;
        $exec->setCommand($command);
        $code = $exec->run();
        $output = $exec->getOutput();

        if ($exec->hasErrors()) {

            switch ($code) {
                case 127:
                    $msg = 'git command not found, make sure it is installed an in the system path';
                    break;
                default:
                    $msg = 'Git execution failed : ' .$code . ' ' . $output['stderror'];
                    break;
            }

            throw new \RuntimeException($msg, $code);
        }

        return $code;
    }
362454
public function exec($command)
    {
        $this->_events[] = $event = new Event($this->_mutex, $command);
        return $event;
    }