Re: wait on procsub in EXIT trap

2023-03-21 Thread Chet Ramey
On 3/21/23 3:53 PM, Grisha Levit wrote: So to wait for a procsub after receiving a terminating signal, one must do so in a trap for the signal itself and not in an EXIT trap. Yes, that would probably work. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars l

Re: wait on procsub in EXIT trap

2023-03-21 Thread Grisha Levit
On Tue, Mar 21, 2023 at 3:28 PM Chet Ramey wrote: > > > Interestingly, if an external command or a subshell is executed after > > the process substitution is started but prior to receipt of the > > signal, the `wait' works fine: > > > > $ (trap 'wait $!; echo $?' EXIT; : <(:); (:); kill 0) > > Bec

Re: wait on procsub in EXIT trap

2023-03-21 Thread Chet Ramey
On 3/19/23 11:10 PM, Grisha Levit wrote: If an EXIT trap is executed after receipt of a terminating signal, waiting on a process substitution within the trap can fail: The terminating signal handler cleans up FIFOs and any running procsubs before running the exit trap, which is the last thing i

wait on procsub in EXIT trap

2023-03-19 Thread Grisha Levit
If an EXIT trap is executed after receipt of a terminating signal, waiting on a process substitution within the trap can fail: $ (trap 'wait $!; echo $?' EXIT; : <(:); kill 0) -bash: wait: pid 83694 is not a child of this shell 127 Interestingly, if an external command or a subshell is executed a