Respect non-zero exit code in subexpressions and blocks#8984
Merged
WindSoilder merged 2 commits intonushell:mainfrom Dec 5, 2023
Merged
Respect non-zero exit code in subexpressions and blocks#8984WindSoilder merged 2 commits intonushell:mainfrom
WindSoilder merged 2 commits intonushell:mainfrom
Conversation
Contributor
|
Thanks @jntrnr, I really like the change, it's much better than my attempt :-D |
Contributor
|
It will fix #7690 |
WindSoilder
approved these changes
Dec 5, 2023
Contributor
There was a problem hiding this comment.
I believe it works fine after some redirection fixes and we disabled pipeline echo in #8292
It has bothered me for a long time, thanks for the fix!
Member
|
@WindSoilder (^false; "hello,world!")on this PR and, even though it correctly does not print the string, it does not return the exit code of |
hardfau1t
pushed a commit
to hardfau1t/nushell
that referenced
this pull request
Dec 14, 2023
# Description This PR changes the way we handled non-zero exit codes to be and early exit between `foo; bar`. If `foo` in the example has a non-zero exit code, `bar` wouldn't be run. This also affects subexpressions.
dmatos2012
pushed a commit
to dmatos2012/nushell
that referenced
this pull request
Feb 20, 2024
# Description This PR changes the way we handled non-zero exit codes to be and early exit between `foo; bar`. If `foo` in the example has a non-zero exit code, `bar` wouldn't be run. This also affects subexpressions.
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.
Description
This PR changes the way we handled non-zero exit codes to be and early exit between
foo; bar. Iffooin the example has a non-zero exit code,barwouldn't be run.This also affects subexpressions.
Note: this breaks some tests, so we'll want to think through a) if we want this approach, b) how do we easily want to say "continue if there is an error" in the same way bash differentiates between
;and&&.User-Facing Changes
This would be a breaking change, as both interactive and scripts could work differently in the presence of non-zero exit codes.
Tests + Formatting
After Submitting