mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-20 14:11:14 -03:00
stop assuming the interrupt key is [ctrl-C]
The recent discussion around allowing the user to change various termios (i.e., stty) settings reminded me that there are places in our code where we assume the interrupt key is [ctrl-C]. That's a bad assumption. Instead use the actual value reported to us by the kernel. This also makes the fkr program friendlier by always reporting when a signal was received, not just when run with -d2, and prompting the user to press the INTR or EOF key a second time to exit.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
@@ -291,8 +292,7 @@ static int interrupt_handler() {
|
||||
if (job_reap(1)) reader_repaint_needed();
|
||||
// Tell the reader an event occured.
|
||||
if (reader_reading_interrupted()) {
|
||||
// Return 3, i.e. the character read by a Control-C.
|
||||
return 3;
|
||||
return shell_modes.c_cc[VINTR];
|
||||
}
|
||||
|
||||
return R_NULL;
|
||||
|
||||
Reference in New Issue
Block a user