← Back to context

Comment by aidenn0

5 days ago

That's good to know; ysh[1] will treat pipelines with a SIGPIPE indicative exit code as successful to allow e.g.

  foo |head -n2

to be treated as successful. I haven't seen anyone complaining yet about rust programs breaking this idiom, but I'll keep an eye out for it.

1: https://oils.pub/release/latest/doc/ysh-tour.html

In other shells, the status of the pipeline is the exit status of the last process, so in this case that would be head which exits with 0.

  • Not in e.g. bash with "pipefail" set. However the pipefail option in bash will choke on my previous example, hence treating a SIGPIPE the same as success in ysh.

    • Yes well, the pipefail option configures bash to do the opposite of its usual behaviour.