Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Console: A failed console command returns a 0 exit code #3175

Closed
BradyBonnette opened this issue Aug 1, 2018 · 3 comments
Closed

Console: A failed console command returns a 0 exit code #3175

BradyBonnette opened this issue Aug 1, 2018 · 3 comments

Comments

@BradyBonnette
Copy link

Description

When running a CraftCMS v3 console command using craft, a failure results in an exit code of 0. This can give false positives to anyone using this in an automated fashion for any reason.

Steps to reproduce

  1. Run a craft console command that results in a failure, such as craft install/plugin fakepluginnotreal
  2. Examine the return value reported by the operating system/shell. For a failure, it should return something other than zero.

Example:

$ craft install/plugin fakepluginnotreal
*** installing fakepluginnotreal
*** failed to install fakepluginnotreal: No plugin exists with the handle "fakepluginnotreal".

$ echo $?
0

Additional info

  • Craft version: 3.0.15
  • PHP version: PHP 7.2.8-1+ubuntu16.04.1+deb.sury.org+1
  • Database driver & version: mysql - MySQL 5.7.23-0ubuntu0.16.04.1
  • Plugins & versions:
cebe/markdown 1.1.2
composer/ca-bundle 1.1.1
composer/composer 1.6.3
composer/semver 1.4.2
composer/spdx-licenses 1.4.0
craftcms/cms 3.0.15
craftcms/oauth2-craftid 1.0.0.1
craftcms/plugin-installer 1.5.2
craftcms/redactor 2.1.5
craftcms/server-check 1.1.1
creocoder/yii2-nested-sets 0.9.0
danielstjules/stringy 3.1.0
doctrine/lexer v1.0.1
egulias/email-validator 2.1.4
elvanto/litemoji 1.4.0
enshrined/svg-sanitize 0.8.2
ezyang/htmlpurifier v4.10.0
guzzlehttp/guzzle 6.3.3
guzzlehttp/promises v1.3.1
guzzlehttp/psr7 1.4.2
justinrainbow/json-schema 5.2.7
league/flysystem 1.0.45
league/oauth2-client 2.3.0
mikehaertl/php-shellcommand 1.4.1
paragonie/random_compat v2.0.17
pixelandtonic/imagine v0.7.1.3
psr/http-message 1.0.1
psr/log 1.0.2
seld/cli-prompt 1.0.3
seld/jsonlint 1.7.1
seld/phar-utils 1.0.1
studioespresso/craft-navigate 1.0.1
swiftmailer/swiftmailer v6.1.1
symfony/console v3.3.6
symfony/debug v3.3.6
symfony/filesystem v3.3.6
symfony/finder v3.3.6
symfony/polyfill-mbstring v1.8.0
symfony/process v3.3.6
the-refinery/cache-clear 1.0.0
twig/twig v2.4.8
vlucas/phpdotenv v2.5.0
yiisoft/yii2 2.0.15.1
yiisoft/yii2-bootstrap 2.0.8
yiisoft/yii2-composer 2.0.7
yiisoft/yii2-debug 2.0.13
yiisoft/yii2-queue 2.1.0
yiisoft/yii2-swiftmailer 2.1.1
zendframework/zend-escaper 2.6.0
zendframework/zend-feed 2.10.2
zendframework/zend-stdlib 3.2.0

@BradyBonnette
Copy link
Author

I just realized that some failed commands return the correct exit code. For example:

$ craft migrate/blahblah
Unknown command: migrate/blahblah
$ echo $?
1

Maybe this only happens with some console commands?

@brandonkelly
Copy link
Member

Thanks for the nudge! Just fixed that for the next release.

@BradyBonnette
Copy link
Author

Wow, awesome fast feedback. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants