summaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenys Vlasenko2017-08-02 16:52:12 +0200
committerDenys Vlasenko2017-08-02 16:52:12 +0200
commitdd4b446f76736c0a13a61a38d7d816b6e6b5fca2 (patch)
treef087ac7c9c2d4a041a55fb3974ee8b9babe336bc /shell/hush.c
parent7c40ddd9500907925041131374cb43eb87ef5494 (diff)
downloadbusybox-dd4b446f76736c0a13a61a38d7d816b6e6b5fca2.zip
busybox-dd4b446f76736c0a13a61a38d7d816b6e6b5fca2.tar.gz
hush: make SIGINT handling visually less confusing
$ echo $$ 18448 $ echo $? <wait here, run "kill -INT 18448" in other shell><press enter> <=== NOTHING?? $ That empty line does not look right. After this patch: $ echo $$ 18448 $ echo $? <wait here, run "kill -INT 18448" in other shell><press enter> ^C $ function old new delta fgetc_interactive 245 246 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/shell/hush.c b/shell/hush.c
index cfefb73..93ed0bc 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2415,14 +2415,14 @@ static int get_user_input(struct in_str *i)
/*timeout*/ -1
);
/* read_line_input intercepts ^C, "convert" it to SIGINT */
- if (r == 0) {
- write(STDOUT_FILENO, "^C", 2);
+ if (r == 0)
raise(SIGINT);
- }
check_and_run_traps();
if (r != 0 && !G.flag_SIGINT)
break;
/* ^C or SIGINT: repeat */
+ /* bash prints ^C even on real SIGINT (non-kbd generated) */
+ write(STDOUT_FILENO, "^C", 2);
G.last_exitcode = 128 + SIGINT;
}
if (r < 0) {