Runs system command
@param string $command
@param boolean $background
@return string
172215
private function exec($command, $background = false) {

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

		return $output;
	}
203135
public function runDrushCommand($command, $quiet = false, $localhost = false)
    {
        if ($command instanceof CommandBuilder) {
            $drush = $command;
        } else {
            $drush = new DrushCommand(null, $localhost);
            foreach (explode('&&', $command) as $string) {
                $drush->command($string);
            }
        }

        return $this->executeEngineCommand(
            $drush,
            $this->getPhpServiceName(),
            [],
            $quiet,
            $localhost
        );
        ;
    }
952315
public function run(CommandInterface $command, ConfigurationInterface $configuration)
    {
        if (!$this->shouldBeExecuted($command, $configuration)) {
            return;
        }

        $this->environmentHelper->putEnvs($command->getEnv());

        $this->runPreCommand($command, $configuration);
        $this->runCommand($command, $configuration);
        $this->runPostCommand($command, $configuration);

        $this->environmentHelper->unsetEnvs($command->getEnv());
        $this->environmentHelper->putEnvs($configuration->getEnv());

        if ($configuration->isDebugMode() && !$configuration->getOutput()->confirm('Should install resume?', true)) {
            throw new InstallException('Install aborted...');
        }
    }
258226
protected function executeCmd($command)
    {
        $process = new $this->processClass($command);
        $process->run();

        if (false === $process->isSuccessful() && strlen($process->getErrorOutput()) > 0) {
            throw new \RuntimeException($process->getErrorOutput());
        }

        return $process->getOutput();
    }
1013684
protected function runCommand($command)
    {
        $process = $this->getProcess();

        $process->setCommandLine(trim($this->find() . ' ' . $command));

        $process->run();

        return $this;
    }
1071936
public static function runCommand($command, $returnStatus = true)
    {
        $return_var = 1;

        //system
        if (\function_exists('system')) {
            ob_start();
            system($command, $return_var);
            $output = ob_get_contents();
            ob_end_clean();

            // passthru
        } elseif (\function_exists('passthru')) {
            ob_start();
            passthru($command, $return_var);
            $output = ob_get_contents();
            ob_end_clean();
            //exec
        } else {
            if (\function_exists('exec')) {
                exec($command, $output, $return_var);
                $output = implode("\n", $output);

                //shell_exec
            } else {
                if (\function_exists('shell_exec')) {
                    $output = shell_exec($command);
                } else {
                    $output = 'Command execution not possible on this system';
                    $return_var = 0;
                }
            }
        }

        if ($returnStatus) {
            return ['output' => trim($output), 'status' => $return_var];
        }

        return trim($output);
    }
716149
public function runCommand($command, OutputInterface $output = null)
    {
        $input = new StringInput($command);

        $command = $this->find($this->getCommandName($input));

        return $command->run($input, $output ?: new NullOutput());
    }
550561
protected function buildCommand(string $command, bool $background = false, bool $sameEnvironment = true): string
	{
		if($sameEnvironment && strpos($command, '--env=') === false && ($environment = $this->app->getEnvironment()) !== null)
		{
			$command .= ' --env=' . $environment;
		}

		$command = PHP_BINARY . ' ' . $this->buildReactorPath() . ' ' . $command . ' 2>&1';

		if(DIRECTORY_SEPARATOR === '\\')
		{
			if($background)
			{
				$command = '/b ' . $command;
			}

			return 'start ' . $command;
		}

		if($background)
		{
			$command .= ' &';
		}

		return $command;
	}
1309490
public function runCommand($command, $allowFailures = false, $callback = null)
    {
        if (is_string($command)) {
            $command = $this->parseProcessArguments($command);
        }

        $builder = new ProcessBuilder($command);
        $builder
            ->setWorkingDirectory(getcwd())
            ->setTimeout(3600)
        ;
        $process = $builder->getProcess();

        $remover = function ($untrimmed) {
            return ltrim(rtrim($untrimmed, "'"), "'");
        };
        if ($this->output instanceof OutputInterface) {
            if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                $commandLine = implode(' ', array_map($remover, explode(' ', $process->getCommandLine())));
                $this->output->writeln('<question>CMD</question> '.$commandLine);
            }
        }

        $process->run($callback);

        if (!$process->isSuccessful() && !$allowFailures) {
            throw new \RuntimeException(trim($process->getErrorOutput()), (int) $process->getExitCode());
        }

        return trim($process->getOutput());
    }
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;
    }
563179
public function findCommand($command, $system = true)
    {
        $file = dirname(__DIR__) . "/Console/Command/" . ucfirst($command) . "Command.php";
        if($this->findFile($file)) {
            return true;
        }
        else {
            return false;
            #throw new Exception($file." Command Class is missing.");
            #exit;
        }
    }
1143758
public void run(String command) throws PHPException {
		try {
			php.execRun(command);
			flushContent();
		} catch (IOException e) {
			LOGGER.error("IO Error with PhpDriver : " + e.toString());
			throw new IOErrorException(flushContentAndDropIOException());
		}
	}
289368
protected function runCommand(Command $command, array $argv, ConsoleIo $io)
    {
        try {
            return $command->run($argv, $io);
        } catch (StopException $e) {
            return $e->getCode();
        }
    }
857822
public function runComposerCommand(string $command, bool $failNonZero = true)
    {
        $this->debug("> composer $command");
        $this->cli->runShellCommand("composer $command", $failNonZero);
    }
84093
public function run($command = null) {
		if ($command && !$this->request->args()) {
			return $this->_default($command);
		}
		$this->request->shift();
		$this->template = $this->template ?: $command;

		if (!$command) {
			return false;
		}
		if ($this->_execute($command)) {
			return true;
		}
		$this->error("{$command} could not be created.");
		return false;
	}
493456
private function runRouteCommand($command, $params = null)
    {
        $this->routerCommand()->runRoute(
            $command,
            $params,
            $this->baseFolder . '/' . $this->paths['controllers'],
            $this->namespaces['controllers']
        );
    }
1242469
protected function composerRunCommand($command)
    {
        $this->info("Run \"$command\".");

        $output = [];
        exec($command, $output, $returnStatusCode);

        if ($returnStatusCode !== 0) {
            throw RuntimeException::commandExecutionFailed($command, $returnStatusCode);
        }

        $this->info("\"$command\" was successfully ran.");
    }