php qt commands exit with status 0 when they report an error
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by locating CliCommand::error() and CliCommand::execute(), then trace how command return values become process exit statuses. Check the config:publish cases listed in the issue and add or run focused tests for reported errors and successful commands. Done means error() leads to status 1, normal completion leads to status 0, and the behavior change is recorded in the changelog.
Written by the indexing model from the issue text.
Description
Summary
A php qt command that stops on an error prints the message with CliCommand::error() and returns, but the process still exits with status 0. CliCommand::execute() calls exec() and always returns Command::SUCCESS. Scripts, deploy steps and CI jobs cannot tell such a failure from a success.
Where it happens
Eight core commands report errors this way: config:publish, cron:run, debugbar, core:env, module:generate, openapi, cache:clear and route:list. Application commands that extend CliCommand behave the same. A command that throws an exception already exits with a non-zero status; only errors reported through error() are affected.
For example, php qt config:publish Cache exits with 0 when shared/config/cache.php already exists and -y is not given, although nothing was published.
Scope
CliCommand::error()marks the command as failed.CliCommand::execute()returnsCommand::FAILUREwhen the command was marked as failed, andCommand::SUCCESSotherwise.exec()keeps its signature, so existing commands, core and application, need no change.
Acceptance criteria
- a command that calls
error()exits with status 1 - a command that finishes without
error()exits with status 0 config:publishexits with 1 for an existing file without-y, an unknown package or module, and a failed copy- the change is listed in the changelog as a behavior change, since scripts that ignored the status may now see failures
- Dominant language
- PHP
- Stars
- 44
- Forks
- 22
- Avg merge
- 2h 49m
- Merged PRs (30d)
- 61
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from quantum-php/framework
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
quantum-php/framework#739 ·
Maintainers usually reply within 1 day
-
tech debt testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
quantum-php/framework#696 ·
Maintainers usually reply within 1 day
-
routing testing
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
quantum-php/framework#547 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
quantum-php/framework#741 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 40/100
quantum-php/framework#740 ·
Maintainers usually reply within 1 day
All issues in quantum-php/framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/blocks-engine#7881 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
iruzen-dono/workless#117 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
magicsunday/webtrees-docker#285 ·
Maintainers usually reply within 1 day
-
area/tests type/bug when/soon
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookPossibly taken @mayankmajeji claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
WordPress/hosting-handbook#521 ·