Task/Process/ProcessLauncherTask.php
protected function handleProcesses(ProcessState $state)
    {
        foreach ($this->launchedProcesses as $key => $process) {
            if (!$process->isTerminated()) {
                // @todo handle incremental error output properly, specially for terminal where logs are lost
                echo $process->getIncrementalErrorOutput();
                continue;
            }

            $logContext = [
                'cmd' => $process->getCommandLine(),
                'input' => $process->getInput(),
                'exit_code' => $process->getExitCode(),
                'exit_code_text' => $process->getExitCodeText(),
            ];
            $this->logger->debug('Command terminated', $logContext);

            unset($this->launchedProcesses[$key]);
            if (0 !== $process->getExitCode()) {
                $this->logger->critical($process->getErrorOutput(), $logContext);
                $this->killProcesses();

                throw new \RuntimeException("Sub-process has failed: {$process->getExitCodeText()}");
            }
        }
    }
protected function handleProcesses(ProcessState $state)
    {
        foreach ($this->launchedProcesses as $key => $process) {
            if (!$process->isTerminated()) {
                // @todo handle incremental error output properly, specially for terminal where logs are lost
                echo $process->getIncrementalErrorOutput();
                continue;
            }

            $logContext = [
                'cmd' => $process->getCommandLine(),
                'input' => $process->getInput(),
                'exit_code' => $process->getExitCode(),
                'exit_code_text' => $process->getExitCodeText(),
            ];
            $this->logger->debug('Command terminated', $logContext);

            unset($this->launchedProcesses[$key]);
            if (0 !== $process->getExitCode()) {
                $this->logger->critical($process->getErrorOutput(), $logContext);
                $this->killProcesses();

                throw new \RuntimeException("Sub-process has failed: {$process->getExitCodeText()}");
            }
        }
    }
@param ProcessState $state

@throws \Symfony\Component\Process\Exception\RuntimeException