bug-bash
[Top][All Lists]
Advanced

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

Re: EXIT trap is not executed after an exec failure in a non-interactive


From: Chet Ramey
Subject: Re: EXIT trap is not executed after an exec failure in a non-interactive shell
Date: Fri, 1 Oct 2021 09:59:44 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 9/30/21 7:24 PM, Mark March wrote:
If execfail is set, a failed exec does not cause a non-interactive shell to 
exit, but it seems to reset the EXIT trap:

Yes. When the shell runs `exec', it assumes the execed program will overlay
the shell process. To make that happen transparently, it has to undo things
it has done: it ends job control and restores the original process groups,
it restores the signal dispositions that it got from its parent, and it
clears other shell state like the EXIT trap.

If the exec fails, it tries to restore some things as well as it can, but
it doesn't try to restore any traps.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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