feature #11385 server:run command: provide more error information (xabbuh)

This PR was merged into the 2.6-dev branch.

Discussion
----------

server:run command: provide more error information

The server:run command didn't provide many information when the executed command exited unexpectedly. Now, the process' exit code is passed through and an error message is displayed.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This is, for example, useful, if you provide an invalid ip address/hostname on which the server couldn't listen.

Commits
-------

5ba40bf server:run command: provide more error information
This commit is contained in:
Fabien Potencier 2014-07-25 07:19:56 +02:00
commit 08529bb1f0

View File

@ -98,10 +98,20 @@ EOF
if (OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { if (OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
$process->disableOutput(); $process->disableOutput();
} }
$this $this
->getHelper('process') ->getHelper('process')
->run($output, $process, null, null, OutputInterface::VERBOSITY_VERBOSE); ->run($output, $process, null, null, OutputInterface::VERBOSITY_VERBOSE);
if (!$process->isSuccessful()) {
$output->writeln('<error>Built-in server terminated unexpectedly</error>');
if ($process->isOutputDisabled()) {
$output->writeln('<error>Run the command again with -v option for more details</error>');
}
}
return $process->getExitCode();
} }
private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env) private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env)