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());
    }
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());
    }
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 ( ) ) ; }
Run a command through the ProcessBuilder.

@param string|array $command
@param bool         $allowFailures
@param \Closure     $callback Callback for Process (e.g. for logging output in realtime)

@return string
Run a command through the ProcessBuilder .