Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11530
| From | Stephane Chazelas <stephane.chazelas@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: SIGINT handling |
| Date | 2015-09-21 22:24 +0100 |
| Message-ID | <mailman.1561.1442870652.19560.bug-bash@gnu.org> (permalink) |
| References | <20150918151439.GA16455@chaz.gmail.com> <20150919203628.GA27872@chaz.gmail.com> <20150921094807.GA6229@chaz.gmail.com> <56005BC4.1070906@case.edu> |
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
Back to gnu.bash.bug | Previous | Next | Find similar
Re: SIGINT handling Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-09-21 22:24 +0100
csiph-web