bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal for a New Bash Option: failfast for Immediate Pipeline Failure


From: ama bamo
Subject: Proposal for a New Bash Option: failfast for Immediate Pipeline Failure
Date: Mon, 24 Jun 2024 16:21:22 +0200

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]