help-bash
[Top][All Lists]
Advanced

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

Re: why are pipeline commands (allowed to be) executed in subshells?


From: Chet Ramey
Subject: Re: why are pipeline commands (allowed to be) executed in subshells?
Date: Tue, 13 Dec 2022 10:49:38 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

On 12/12/22 8:29 PM, Philippe Cerfon wrote:
On Sat, Nov 26, 2022 at 6:48 PM Chet Ramey <chet.ramey@case.edu> wrote:

So when I have e.g.
while true; do
     sleep 60
     check_for_condition && break
done

as well as a trap on e.g. HUP and INT that set some condition to be true,
and then send a HUP to the executing shell, I'd expect that it
waits(!) for the sleep to finish until it breaks out of the loop. And
indeed it does. The HUP signal is only received by the shell, the
child processes don't seem to get it.


However, when sending an INT, the child immediately seems to see the INT.

I can't reproduce this in either interactive or non-interactive shells.

--
``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]