Re: Bash exits with "Broken pipe" with process subsitution and sleep
From:
Maria
Subject:
Re: Bash exits with "Broken pipe" with process subsitution and sleep
Date:
Sun, 31 Aug 2025 19:20:58 +0000
On Sunday, August 31st, 2025 at 3:12 PM, Andreas Schwab <schwab@linux-m68k.org>
wrote:
> On Aug 31 2025, Maria wrote:
>
> > When I redirect the output of a command that sleeps into a process
> > substitution with a process that finishes immediately (like "echo" or
> > a process that doesn't exist), after the first sleep, Bash will crash
> > with exit code 141.
>
>
> This is not a crash, it is normal behaviour in presence of a signal.
> You can replace the shell command with any program that produces enough
> output, you will get exactly the same behaviour.
>
> $ yes > >(:); echo $?
>
> 141
> $ yes | :; echo ${PIPESTATUS[*]}
> 141 0
>
> (141 is 128 + SIGPIPE.)
Please try the command I provided, particularly the one that starts
with "for". I tried the input you provided, and indeed it is just
the subprocess that exits, but with my input, it is Bash itself that
exits, not the subprocess.