pipefail: avoid try outputs value when catch exists, avoid finally runs twice, avoid finally funs before try finish.#17764
Merged
WindSoilder merged 4 commits intonushell:mainfrom Mar 12, 2026
Conversation
ba83f3f to
9a9fe38
Compare
9a9fe38 to
fe5397e
Compare
aionescu
reviewed
Mar 10, 2026
8d63d29 to
62701df
Compare
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.
Fixes: #17730
Fixes: #17715
Fixes: #17567
This pr is going to do the following things in order to fix these issues at once:
Instruction::Collectignorepipefailchecking, so anything invoves collect won't check pipefail, for example: let, argument passing, binary operation, match expressioncatchblock orfinallyblock. This is done by adding a newInstruction::CollectFailuableafter relative block. It is similar toInstruction::Collect, except it checks pipefail.finallyblock, evaluatePopFinallyRuninstruction first, this avoids duplicate finally block runs.Release notes summary - What our users need to know
finally block won't run twice if error produced in finally block
It prints "inside finally" once.
finally block won't run before try/catch finished
Finally won't run before try finished.
NOTES ABOUT STREAMING:
try won't streaming if
catchorfinallyexists.catch won't streaming if
finallyexistslet ignores pipefail checking
The variable
xwill be assigned.Try doesn't produce output if it has an error
It returns
result-on-catch, and redundanttruewon't be outputed.Tasks after submitting
NaN