At 2025-08-31T19:20:58+0000, Maria wrote: > On Sunday, August 31st, 2025 at 3:12 PM, Andreas Schwab > <[email protected]> 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".
>>> for i in 1 2 3 4 5; do sleep 1; echo $i; done > >(echo) > 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. I wonder if the `lastpipe` shell option is implicated. "If the lastpipe option is enabled using the shopt builtin (see The Shopt Builtin), and job control is not active, the last element of a pipeline may be run by the shell process." https://www.gnu.org/software/bash/manual/html_node/Pipelines.html Regards, Branden
signature.asc
Description: PGP signature
