Skip to content

feat: "pipefail" option makes pipe return error code if any non zero

Florian Naumann requested to merge bool_purist/ion:feat_pipeline_fail into master

Instead of last command.

Early exit error in pipeline also shows error code. Document "pipefail" option in builtin.

This features was requested in the issue #1005

Note

This behaves the same as in bash. All commands in the pipeline are executed before the error code is returned from the pipeline.

Which command make up the error code of the pipeline

The 1. non zero code propagated is not necessarily the left most command which returned an error. This due to the fact that ion shell right now does not keep track of the order of executed command in the pipeline.

Example: command1 | command2 | command3. command2 and command3 return a non zero code. It can happen command3 exits with an error earlier. So in this example the error code of the command3 is returned.

Changing that is outside of the scope of this PR.

Edited by Florian Naumann

Merge request reports