help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Ctrl-G in emacs does not send SIGINT to the parent shell. How did yo


From: Emanuel Berg
Subject: Re: Ctrl-G in emacs does not send SIGINT to the parent shell. How did you do that?
Date: Sun, 27 Jun 2021 14:52:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Masahiro Yamada wrote:

> Hello.
>
> I found this thread reported in 2012:
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2012-07/msg00311.html
>
> It reported that Ctrl-G in an emacs running in a terminal
> sends a SIGINT to the parent shell.
>
> I tested it in newer Emacs version (Emacs 26.3), and found
> the behavior was opposite.
>
> So, something has changed since then.
>
> I'd like to know what was changed.
>
> The following is the detailed steps for my tests.
>
> I invoked 'emacs -nw' from bash running in a terminal.
>
> Let's say I am using the terminal, /dev/pts/28.
>
> I used 'stty' from another terminal in order to confirm
> 'intr' key was changed to ^G from ^C.
>
> $ stty -a  -F  /dev/pts/28
> speed 38400 baud; rows 27; columns 224; line = 0; intr = ^G;
> quit = ^G; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; [
> snip ]
>
> I used strace to check if SIGINT was delivered when
> I pressed Ctrl-G.
>
> I opened another terminal, and ran:
>
>   $ sudo strace  -e trace=signal  -p  <pid-of-emacs>
>
> I opened yet anther terminal, and ran:
>
>   $ sudo strace  -e trace=signal  -p  <pid-of-parent-shell>
>
> When I pressed Ctrl-G in the Emacs window, I saw SIGINT logs
> in the first terminal, which is tracing the emacs.
>
> In contrast, I saw nothing in the second one, which is
> tracing the parent shell.
>
> In my understanding, when a user provides
> keyboard-interrupt, all the foreground processes in that
> terminal will receive SIGINT. How can Emacs block SIGINT
> from being delivered to the parent shell?
>
> BTW, I noticed this when I was reading this article:
> https://www.cons.org/cracauer/sigint.html
>
> That article says:
>  "If C-g is used in Emacs, both the shell and Emacs will
>   have received SIGINT. Emacs will not exit, the user used
>   C-g as a normal editing keystroke, he/she does not want
>   the script to be aborted on C-g."
>
> It also contradicts to the current behavior of Emacs.
>
> I am curious how the current behavior was archieved.
>
> Thanks.

:O

I like this one :)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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