all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <871r8nfp12.fsf@zoho.eu> (raw)
In-Reply-To: CAK7LNAT=VYrooMfauK5TUqdqCRKoiBXJvoj-wWiaPdnLxx2BgQ@mail.gmail.com

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	other threads:[~2021-06-27 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27 12:25 Ctrl-G in emacs does not send SIGINT to the parent shell. How did you do that? Masahiro Yamada
2021-06-27 12:52 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r8nfp12.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.