bug-bash
[Top][All Lists]
Advanced

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

Re: signals ignored in a subshell


From: Oğuz
Subject: Re: signals ignored in a subshell
Date: Mon, 6 Apr 2020 15:06:02 +0300

Or, is it that when job controls are enabled each synchronous command is
run in its own process group and SIGINT is not sent to the shell at all?

6 Nisan 2020 Pazartesi tarihinde Oğuz <address@hidden> yazdı:

> That's not how read is defined to behave. wait has special wording defining
>> what happens when it receives a signal. Bash default mode behaves as I
>> described previously -- trapping the signal and returning from the handler
>> results in the read being restarted -- and posix mode will run the trap
>> handler before returning from the `read' builtin.
>>
>
> Okay, you're right, in posix mode the behavior is as expected. However I
> still didn't get why job controls being enabled/disabled changes the way an
> interactive shell handles signals in posix mode. Like
>
> $ set -o posix
> $
> $ trap 'echo foo' INT
> $
> $ read
> ^Cfoo
> $ sleep 5
> ^C
> $
> $ set +m
> $
> $ read
> ^Cfoo
> $ sleep 5
> ^Cfoo
>
> Is there a race condition here or does posix mandate this behavior for
> built-in utilities?
>
>
> --
> Oğuz
>
>

-- 
Oğuz


reply via email to

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