[Top][All Lists]

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

wait on procsub in EXIT trap

From: Grisha Levit
Subject: wait on procsub in EXIT trap
Date: Sun, 19 Mar 2023 23:10:34 -0400

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

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)

reply via email to

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