[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 22:24:03 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
2015-09-21 15:34:28 -0400, Chet Ramey:
> On 9/21/15 5:48 AM, Stephane Chazelas wrote:
>
> > I'm not sure I prefer that WCE approach over WUE. Wouldn't it be
> > preferable that applications that intercept SIGINT/QUIT/TSTP for
> > anything other than clean-up before exit/suspend implement job
> > control themselves instead (like vi's :! should create a process
> > group and make that the foreground process group of the
> > terminal so pressing ^C in sh -c vi, :!sleep 10, only sends the
> > SIGINT to sleep)?
>
> The classic example is emacs remapping the terminal intr key to ^G
> and using SIGINT as its internal abort-command signal.
[...]
AFAICT emacs starts a new process group (and makes it the
foreground process group).
UID PID PPID PGID SID C STIME TTY TIME CMD
chazelas 12232 5595 12232 12232 0 15:00 pts/13 00:00:00 /bin/zsh
chazelas 13609 12232 13609 12232 0 22:14 pts/13 00:00:00 sh -c emacs;
echo test
chazelas 13610 13609 13610 12232 0 22:14 pts/13 00:00:00 emacs
>From strace:
13766 setpgid(0, 0) = 0
13766 ioctl(3, TIOCSPGRP, [13766]) = 0
If it didn't, we could not use it in scripts of shells that
don't do WCE *but also in non-shell scripts* (perl, python,
ruby...) or non-scripts.
A real-life problem though is things like:
sh -c 'vi; echo hi'
Where if you run :!sleep 10 and interrupt it with Ctrl-C, the
"echo hi" is not run in shells that don't do WCE (and non-shell
scripts and non-scripts that don't do it either).
--
Stephane
- SIGINT handling, Stephane Chazelas, 2015/09/18
- Re: SIGINT handling, Stephane Chazelas, 2015/09/19
- Re: SIGINT handling, Stephane Chazelas, 2015/09/21
- Re: SIGINT handling, Chet Ramey, 2015/09/21
- Re: SIGINT handling,
Stephane Chazelas <=
- Re: SIGINT handling, Stephane Chazelas, 2015/09/21
- Re: SIGINT handling, Chet Ramey, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling, Chet Ramey, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
Re: SIGINT handling, Chet Ramey, 2015/09/19