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
Implement pipefail and errexit #4351
Implement pipefail and errexit #4351
Comments
More context:
A robust script can not afford to ignore the possibility that any of the external commands it executes may fail. Often the right choice of action is to fail fast because the code that follows requires that the preceding commands executed successfully. Unix-y pipelines have an issue: foo | bar If Unfortunately |
I also miss this feature, which is quite important in my opinion. Two use cases are
and
I guess these use cases are rather common, but the lack of some pipefail equivalent makes them painful with xonsh. |
I want to know when a command other then the last command in the pipeline fails for any reason. If a command in the middle of a pipeline fails, the last command simply sees a EOF in its stdin. In many cases this will result in the last command returning success. Silently ignoring such errors can lead to all kinds of data loss, data corruption, truncation and other badness. Ideally any unhandled errors should terminate the script.
bash has pipefail:
VVV
Note: the above example does not print "two"
VVV
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 commentThe text was updated successfully, but these errors were encountered: