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