Skip to content

Commit 6bbd5aa

Browse files
committed
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
2 parents 9c41f99 + 005bee6 commit 6bbd5aa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Command/ServerRunCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
9898
if (OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
9999
$process->disableOutput();
100100
}
101-
101+
102102
$this
103103
->getHelper('process')
104104
->run($output, $process, null, null, OutputInterface::VERBOSITY_VERBOSE);
105+
106+
if (!$process->isSuccessful()) {
107+
$output->writeln('<error>Built-in server terminated unexpectedly</error>');
108+
109+
if ($process->isOutputDisabled()) {
110+
$output->writeln('<error>Run the command again with -v option for more details</error>');
111+
}
112+
}
113+
114+
return $process->getExitCode();
105115
}
106116

107117
private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env)

0 commit comments

Comments
 (0)