bug-bash
[Top][All Lists]
Advanced

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

Re: SIGINT handling during async functions


From: Robert Elz
Subject: Re: SIGINT handling during async functions
Date: Fri, 13 Jan 2023 09:13:10 +0700

Oh, the differences in what trap -p is printing is because
of special case handling for trap in a subshell environment,
when the trap command is the first (maybe only) command
executed (details vary between shells).  That is mostly
intended to allow T=$(trap -p) to work, but is usually applied
to any subsell environment (it is simpler that way).
An async command is a subshell environment.

When you do foofunc& the trap command thus prints the
trap from the parent's environment, but when you  embed
that ina group, the traps get reset to those for the
subshell before the trap command gets to run, so you see
that instead.

Everything is working as intended.

kre




reply via email to

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