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;
    }