Hacker News new | ask | show | jobs
by simiones 2 days ago
If you are running Emacs, either in the terminal or in graphical mode, pressing Ctrl+C does not generate any interrupt signal, it simply passes the C-c key to Emacs, which is just a general key bind.

Now, C-c in particular is the key stroke which non-core modes are recommended to use for their key binds (for example, sgml-mode uses C-c as a prefix for all of its commands, e.g. C-c C-f for sgml-skip-tag-forward, C-c C-b for sgml-skip-tag-backward, etc). Running `killall -SIGINT emacs` will not be interpreted as a C-c key being hit in emacs, it will just cause emacs to quit.

The same thing is true for other terminal based programs, like vi. Pressing Ctrl+C in vi does not generate an interrupt signal, it just passes this key combo to vi to do with as it pleases.

1 comments

Yes, but the old ways were that the terminal interface itself was in charge of translating this keycode to a signal, based on the line discipline of the terminal. It was a consistent behavior across many apps unless they took effort to modify the current terminal line discipline, i.e. put the terminal into a raw mode. And then many apps tried to do something appropriately signal-like when they decided to handle these input characters without signals.