Repository navigation
update ignore to really ignore :) - #18306
Merged
Merged
Conversation
2 tasks done
|
Hey what about |
Contributor
Author
no plans for that |
In future? |
Contributor
Author
|
I gave up predicting the future long ago. |
Contributor
Author
|
Also, all those operators are redirecting, not ignoring, so I'm not sure why they'd be deprecated. |
we have |
fdncred
added a commit
that referenced
this pull request
Nov 24, 2026
…`tee` (#19647) ## Description Since 0.114.0, `try` skips `catch` when it's piped into `ignore`, `complete`, `save` or `tee` and the error comes from the last command in its block. `finally` still runs, but it gets the raw error as its input and parameter, so the first command there that reads either one raises the error again. The case most likely to bite is a custom command that ends in a `try`. Call it as `my-command | ignore` and its `catch` never runs. #18306 made a command return its error as a value when its stderr goes to a separate pipe. That lets `ignore --stderr` decide what to do with the error. All four commands above ask for that separate pipe, and the last command in a `try` block inherits the redirection of whatever follows the `try`. So the error turned into a value, passed through `try` without reaching `catch`, and the next command raised it. Up to 0.117.0, a `;` after the pipeline discarded the error. #19467 stopped that, so on main the error surfaces. `try` now raises an error value that reaches the end of its block, or the end of `catch` before `finally`. The handlers run the same as they do without the pipe. When only `finally` handles the error, `finally` gets the error record. Then the error goes on to the next command as a value, the same as without `finally`, so `ignore --stderr` still consumes it. ## User-facing changes (Release notes) - Fixed `try` skipping `catch` when it's piped into `ignore`, `complete`, `save` or `tee`, including through a custom command that ends in a `try`. In the same case `finally` now gets the error record instead of the raw error. This was a regression in 0.114.0. - `try { ... } catch { 'fallback' } | ignore --stderr` now passes on `fallback` instead of consuming the error, and `try { exit 3 } | ignore --stderr` now exits. ## Additional notes
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 expands
ignoreso callers can explicitly control which streams (stderr, stdout) are consumed and when errors should be surfaced and update$env.LAST_EXIT_CODE.User-facing changes (Release notes)
Added stream and error controls to
ignoreUpdate the
ignorecommand with flags to control whether stderr, stdout, or both get consumed and if errors are show which update$env.LAST_EXIT_CODE. This should work on internal and external commands.Existing behavior is the default when no new flags are provided to avoid breaking changes.
--stderr(-e) to consume stderr while allowing stdout to pass through.--stdout(-o) to consume stdout while allowing stderr output through.--show-errors(-x) to show external/internal errors and set$env.LAST_EXIT_CODE(external exit code for external failures,1for internal failures).Additional notes
Closes #17849
Closes #18203
Related #15802
Related #12643