-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Send an exit code when the script terminates #93
Conversation
This fixes the issue identified in #80 (comment) where even when the setting of `installed_paths` failed, the plugin would exit with exit code `0`. A `0` exit code will be returned if successful, `1` - or the exit code returned by PHPCS itself - if not.
Thanks for the reminder! Crazy/Busy/Hectic, as always. I've got time to look at this (and other issues) coming Friday. Will report back then. 👍 |
This changes breakes my CI, because when I run --no-dev, then composer removes squizlabs/php_codesniffer + this package and this package exit with "PHPCodeSniffer is not installed". Is it not possible to check whether composer removes "squizlabs/php_codesniffer" and print just a warning without exitcode 1? |
@tobiasbaehr please open a issue for this, including the steps your CI takes to trigger this case |
@tobiasbaehr Good point, not a situation I'd considered. |
Oh and just to be clear: the reason I'd not considered it, is that I would expect the More information on why these are not aligned in your case would be appreciated, so I can properly understand the usecase. |
I'm bit pressed for time right now, but I've got some time later today to pick this up. I would like to get a fix and deploy a v0.6.1 release for the issue he mentioned ASAP, prefereably before the end of the weekend. (Luckily, I had already reserved time for any fall-out from the v0.6.0 release) |
Proposed Changes
This fixes the issue identified in #80 (comment) where even when the setting of
installed_paths
failed, the plugin would exit with exit code0
.A
0
exit code will be returned if successful,1
- or the exit code returned by PHPCS itself - if not.This will allow wrapper scripts and/or process scripts which take exit codes into account to fail correctly and/or notify users of failure.
Testing this change
vendor
directory andcomposer.lock
file.master
branch.composer install
.vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist
file tovendor/squizlabs/php_codesniffer/CodeSniffer.conf
and make itread only
.composer install-codestandards --verbose
.The output will look something like:
echo $?
and take note of the exit code being0
(= success).composer install-codestandards --verbose
again.echo $?
and take note of the exit code now being1
(= failure).Another test which tests another part of this change:
vendor/squizlabs/php_codesniffer
directory.master
, runcomposer install-codestandards --verbose
.The output will look something like:
echo $?
and take note of the exit code being0
(= success).composer install-codestandards --verbose
again.echo $?
and take note of the exit code now being1
(= failure).