Dear Bash Maintainers, I have encountered a challenge with the current implementation of pipelines in Bash, specifically regarding subshells and the pipefail option. As documented, each command in a pipeline is executed in its own subshell, and Bash waits for all commands in the pipeline to terminate before returning a value.
To address these issues, I propose the introduction of a new option, failfast, which would immediately terminate the pipeline if any command in the pipeline fails. This would streamline error handling and provide more predictable script execution, aligning with user expectations in many common use cases. Here is an example illustrating the proposed behavior: ```` #!/bin/bash set -o failfast nonexisting-command | sleep 10# Pipeline exits immediately without sleeping for 10 seconds ```` This would provide a more intuitive and robust error handling mechanism for pipeline commands, enhancing the usability and reliability of Bash scripting. I look forward to your feedback. Best regards, Mateusz Kurowski