protected function runProcess(Process $process, $mustRun = false, $quiet = true)
    {
        try {
            $process->mustRun($quiet ? null : function ($type, $buffer) {
                $output = $type === Process::ERR ? $this->stdErr : $this->output;
                $output->write(preg_replace('/^/m', '  ', $buffer));
            });
        } catch (ProcessFailedException $e) {
            if (!$mustRun) {
                return $process->getExitCode();
            }
            // The default for Symfony's ProcessFailedException is to print the
            // entire STDOUT and STDERR. But if $quiet is disabled, then the user
            // will have already seen the command's output.  So we need to
            // re-throw the exception with our own ProcessFailedException, which
            // will generate a much shorter message.
            throw new \Platformsh\Cli\Exception\ProcessFailedException($process, $quiet);
        }
        $output = $process->getOutput();

        return $output ? rtrim($output) : true;
    }
protected function runProcess(Process $process, $mustRun = false, $quiet = true)
    {
        try {
            $process->mustRun($quiet ? null : function ($type, $buffer) {
                $output = $type === Process::ERR ? $this->stdErr : $this->output;
                $output->write(preg_replace('/^/m', '  ', $buffer));
            });
        } catch (ProcessFailedException $e) {
            if (!$mustRun) {
                return $process->getExitCode();
            }
            // The default for Symfony's ProcessFailedException is to print the
            // entire STDOUT and STDERR. But if $quiet is disabled, then the user
            // will have already seen the command's output.  So we need to
            // re-throw the exception with our own ProcessFailedException, which
            // will generate a much shorter message.
            throw new \Platformsh\Cli\Exception\ProcessFailedException($process, $quiet);
        }
        $output = $process->getOutput();

        return $output ? rtrim($output) : true;
    }
protected function runProcess ( Process $ process , $ mustRun = false , $ quiet = true ) { try { $ process -> mustRun ( $ quiet ? null : function ( $ type , $ buffer ) { $ output = $ type === Process :: ERR ? $ this -> stdErr : $ this -> output ; $ output -> write ( preg_replace ( '/^/m' , '  ' , $ buffer ) ) ; } ) ; } catch ( ProcessFailedException $ e ) { if ( ! $ mustRun ) { return $ process -> getExitCode ( ) ; } // The default for Symfony's ProcessFailedException is to print the // entire STDOUT and STDERR. But if $quiet is disabled, then the user // will have already seen the command's output.  So we need to // re-throw the exception with our own ProcessFailedException, which // will generate a much shorter message. throw new \ Platformsh \ Cli \ Exception \ ProcessFailedException ( $ process , $ quiet ) ; } $ output = $ process -> getOutput ( ) ; return $ output ? rtrim ( $ output ) : true ; }
Run a process.

@param Process $process
@param bool    $mustRun
@param bool    $quiet

@throws \Symfony\Component\Process\Exception\RuntimeException
If the process fails or times out, and $mustRun is true.

@return int|string
The exit code of the process if it fails, true if it succeeds with no
output, or a string if it succeeds with output.
Run a process .