|
15 | 15 | use Symfony\Component\Console\Input\InputOption;
|
16 | 16 | use Symfony\Component\Console\Input\InputInterface;
|
17 | 17 | use Symfony\Component\Console\Output\OutputInterface;
|
| 18 | +use Symfony\Component\Console\Output\ConsoleOutputInterface; |
18 | 19 | use Symfony\Component\Console\Style\SymfonyStyle;
|
19 | 20 | use Symfony\Component\Process\PhpExecutableFinder;
|
| 21 | +use Symfony\Component\Process\Process; |
20 | 22 | use Symfony\Component\Process\ProcessBuilder;
|
| 23 | +use Symfony\Component\Process\Exception\RuntimeException; |
21 | 24 |
|
22 | 25 | /**
|
23 | 26 | * Runs Symfony application using PHP built-in web server.
|
@@ -113,14 +116,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
|
113 | 116 | $builder->setWorkingDirectory($documentRoot);
|
114 | 117 | $builder->setTimeout(null);
|
115 | 118 | $process = $builder->getProcess();
|
| 119 | + $callback = null; |
116 | 120 |
|
117 |
| - if (OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { |
| 121 | + if (OutputInterface::VERBOSITY_NORMAL > $output->getVerbosity()) { |
118 | 122 | $process->disableOutput();
|
| 123 | + } else { |
| 124 | + try { |
| 125 | + $process->setTty(true); |
| 126 | + } catch (RuntimeException $e) { |
| 127 | + $callback = function ($type, $buffer) use ($output) { |
| 128 | + if (Process::ERR === $type && $output instanceof ConsoleOutputInterface) { |
| 129 | + $output = $output->getErrorOutput(); |
| 130 | + } |
| 131 | + $output->write($buffer, false, OutputInterface::OUTPUT_RAW); |
| 132 | + }; |
| 133 | + } |
119 | 134 | }
|
120 |
| - |
121 |
| - $this |
122 |
| - ->getHelper('process') |
123 |
| - ->run($output, $process, null, null, OutputInterface::VERBOSITY_VERBOSE); |
| 135 | + $process->run($callback); |
124 | 136 |
|
125 | 137 | if (!$process->isSuccessful()) {
|
126 | 138 | $errorMessages = array('Built-in server terminated unexpectedly.');
|
|
0 commit comments