Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
chalasr merged 1 commit intosymfony:2.8frommpdude:fix-exit-code-for-listeners
Sep 23, 2018

Conversation

@mpdude
Copy link
Contributor

@mpdudempdude commentedSep 21, 2018
edited
Loading

QA
Branch?2.8
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

When a Console command throws an exception without a status code,Application::run() takes care of setting the exit code to1 when the exception does not provide a code itself.

This happens slightly too late, asconsole.terminate event listeners that are called from withinApplication::doRunCommand() are given the plain exeception code, before this conversion.

The result is thatconsole.* event listeners that you might be using to log exit code e. g. for cron jobs will see a0 code instead of the real value used to terminate the script.

Todo:

  • Make sure we've got tests covering this, i. e. do not mock outdoRunCommand().

xkons reacted with thumbs up emoji
@mpdude
Copy link
ContributorAuthor

3.4 does not have this bug, most likely due to#22441

@mpdudempdude changed the title[Console] RFC: Send the right exit code to console.terminate listeners[Console] Send the right exit code to console.terminate listenersSep 21, 2018
@nicolas-grekasnicolas-grekas added this to the2.8 milestoneSep 22, 2018
@nicolas-grekas
Copy link
Member

at least tests fail :)

@mpdude
Copy link
ContributorAuthor

@nicolas-grekas Will work on tests if you agree we should fix it on 2.8.

@nicolas-grekas
Copy link
Member

We might also just wait for 2.8 to fade out if you don't have time to work on this :)

mpdude reacted with laugh emoji

@mpdude
Copy link
ContributorAuthor

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
Copy link
ContributorAuthor

@nicolas-grekas Tests added – does it make sense to omit theException type hint to be PHP 5 and 7 compatible (no\Throwable on PHP 5 but possibly have to handle\Error on PHP7)?

@chalasrchalasrforce-pushed thefix-exit-code-for-listeners branch from79066c8 tob90a3f1CompareSeptember 23, 2018 10:04
@chalasr
Copy link
Member

Thank you@mpdude.

@chalasrchalasr merged commitb90a3f1 intosymfony:2.8Sep 23, 2018
chalasr pushed a commit that referenced this pull requestSep 23, 2018
…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
@mpdudempdude deleted the fix-exit-code-for-listeners branchSeptember 23, 2018 17:21
This was referencedSep 30, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

2.8

Development

Successfully merging this pull request may close these issues.

4 participants

@mpdude@nicolas-grekas@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp