Improved error handling in the use and switch commands#1114
Merged
morozov merged 1 commit intophpbrew:masterfrom Dec 21, 2019
morozov:shell-error-handling
Merged
Improved error handling in the use and switch commands#1114morozov merged 1 commit intophpbrew:masterfrom morozov:shell-error-handling
morozov merged 1 commit intophpbrew:masterfrom
morozov:shell-error-handling
Conversation
Prior to the fix, the commands didn't return the proper exit code in the case of an error and didn't correctly handle the error exit code of the underlying `env` command. **Fish:** ``` $ phpbrew use blah PHP version blah is not installed. $ echo $status 0 $ phpbrew switch blah Invalid: command not found ~/.phpbrew/init (line 2): Invalid argument blah ^ from sourcing file ~/.phpbrew/init called on line 794 of file ~/.phpbrew/phpbrew.fish in function “__phpbrew_update_config” called on line 807 of file ~/.phpbrew/phpbrew.fish with parameter list “blah” in function “__phpbrew_reinit” called on line 397 of file ~/.phpbrew/phpbrew.fish with parameter list “blah” in function “phpbrew” called on standard input with parameter list “switch blah” $ echo $status 0 $ cat ~/.phpbrew/init Invalid argument blah ``` **Bash:** ``` $ phpbrew use blah PHP version blah is not installed. $ echo $? 0 $ phpbrew switch blah Invalid: command not found $ echo $? 0 $ cat ~/.phpbrew/init Invalid argument blah ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to the fix, the commands didn't return proper exit code in the case of an error and didn't correctly handle the error exit code of the underlying
envcommand.Fish:
Bash: