bug-bash
[Top][All Lists]
Advanced

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

Re: SIGINT handling


From: Stephane Chazelas
Subject: Re: SIGINT handling
Date: Mon, 21 Sep 2015 16:58:54 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2015-09-21 17:35:36 +0200, Jilles Tjoelker:
[...]
> > One could also argue, that to be consistent, SIGTSTP and SIGQUIT
> > should be treated similarly (strangely enough
> > http://www.cons.org/cracauer/sigint.html doesn't mention SIGTSTP).
> 
> Agreed for SIGQUIT, but not for SIGTSTP. For SIGTSTP, either the shell
> has job control enabled or it does not. If it does, SIGTSTP stops the
> job and continues the shell; if it does not, SIGTSTP stops the whole job
> including the shell.
[...]

Note sure what you mean, we may not be talking of the same thing.

What I meant:

In:

sh -c '(trap "" INT; sleep 10); echo done'

If you send ^C, nothing happens.

In:

sh -c '(trap "" TSTP; sleep 10); echo done'

If you press ^Z, the "sh" is suspended, but "sleep" keeps
running in background.

One could argue they should be treated the same (that sh
shouldn't suspend itself if the process it's currently waiting
for has not been suspended, just like for ^C it should not die
of SIGINT if the process it's currently waiting for has not died
of SIGINT).

You may be talking of:

sh -mc 'sleep 10; echo "$?"'

where SIGINT upon ^C, SIGTSTP upon ^Z is sent to sleep only (not
sh).

-- 
Stephane



reply via email to

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