-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
server:run command: provide more error information #11385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
$this | ||
->getHelper('process') | ||
->run($output, $process, null, null, OutputInterface::VERBOSITY_VERBOSE); | ||
|
||
if ($process->getExitCode() === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have used !$process->isSuccessful()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, the error output would also be shown if the process was terminated by something like kill
(the exit code then is 143). Do we consider that to be an unexpected termination? If so, I'll agree with you and will change the code accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would indeed exclude cases where we explicitly interrupt the server (like CTRL+C), but 1 is not the only case for which we need to display this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code. But, 143 is the exit code when the process is kill by another process. Handling Ctrl+C would require some more work (honestly, I'm not sure if that could be handled at all).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To handle Ctrl+C you would have to use POSIX signals (listen to SIGINT) but it will only work on UNIX systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think catching Ctrl+C in this context is not really necessary since the server is stopped in this way. Of course, you could handle the signal and ask the user to confirm the termination. But that's not really convenient in most situations I guess.
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.
👍 |
Thank you @xabbuh. |
…bbuh) 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
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.
This is, for example, useful, if you provide an invalid ip address/hostname on which the server couldn't listen.