Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] Send the right exit code to console.terminate listeners#28545
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
mpdude commentedSep 21, 2018
3.4 does not have this bug, most likely due to#22441 |
nicolas-grekas commentedSep 22, 2018
at least tests fail :) |
mpdude commentedSep 22, 2018
@nicolas-grekas Will work on tests if you agree we should fix it on 2.8. |
nicolas-grekas commentedSep 22, 2018
We might also just wait for 2.8 to fade out if you don't have time to work on this :) |
mpdude commentedSep 22, 2018
I was expecting this :-) Personally, I‘ll probably have to deal with 2.8 for another year so I‘d be glad to have this fixed. |
mpdude commentedSep 22, 2018
@nicolas-grekas Tests added – does it make sense to omit the |
79066c8 tob90a3f1Comparechalasr commentedSep 23, 2018
Thank you@mpdude. |
…steners (mpdude)This PR was squashed before being merged into the 2.8 branch (closes#28545).Discussion----------[Console] Send the right exit code to console.terminate listeners| Q | A| ------------- | ---| Branch? | 2.8| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |When a Console command throws an exception without a status code, `Application::run()` takes care of setting the exit code to `1` when the exception does not provide a code itself.This happens slightly too late, as `console.terminate` event listeners that are called from within `Application::doRunCommand()` are given the plain exeception code, before this conversion.The result is that `console.*` event listeners that you might be using to log exit code e. g. for cron jobs will see a `0` code instead of the real value used to terminate the script.***Todo:***- [x] Make sure we've got tests covering this, i. e. do not mock out `doRunCommand()`.Commits-------b90a3f1 [Console] Send the right exit code to console.terminate listeners
Uh oh!
There was an error while loading.Please reload this page.
When a Console command throws an exception without a status code,
Application::run()takes care of setting the exit code to1when the exception does not provide a code itself.This happens slightly too late, as
console.terminateevent listeners that are called from withinApplication::doRunCommand()are given the plain exeception code, before this conversion.The result is that
console.*event listeners that you might be using to log exit code e. g. for cron jobs will see a0code instead of the real value used to terminate the script.Todo:
doRunCommand().