diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-02 16:52:12 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-02 16:52:12 +0200 |
commit | dd4b446f76736c0a13a61a38d7d816b6e6b5fca2 (patch) | |
tree | f087ac7c9c2d4a041a55fb3974ee8b9babe336bc /shell/hush.c | |
parent | 7c40ddd9500907925041131374cb43eb87ef5494 (diff) | |
download | busybox-w32-dd4b446f76736c0a13a61a38d7d816b6e6b5fca2.tar.gz busybox-w32-dd4b446f76736c0a13a61a38d7d816b6e6b5fca2.tar.bz2 busybox-w32-dd4b446f76736c0a13a61a38d7d816b6e6b5fca2.zip |
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.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shell/hush.c b/shell/hush.c index cfefb7324..93ed0bc0b 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2415,14 +2415,14 @@ static int get_user_input(struct in_str *i) | |||
2415 | /*timeout*/ -1 | 2415 | /*timeout*/ -1 |
2416 | ); | 2416 | ); |
2417 | /* read_line_input intercepts ^C, "convert" it to SIGINT */ | 2417 | /* read_line_input intercepts ^C, "convert" it to SIGINT */ |
2418 | if (r == 0) { | 2418 | if (r == 0) |
2419 | write(STDOUT_FILENO, "^C", 2); | ||
2420 | raise(SIGINT); | 2419 | raise(SIGINT); |
2421 | } | ||
2422 | check_and_run_traps(); | 2420 | check_and_run_traps(); |
2423 | if (r != 0 && !G.flag_SIGINT) | 2421 | if (r != 0 && !G.flag_SIGINT) |
2424 | break; | 2422 | break; |
2425 | /* ^C or SIGINT: repeat */ | 2423 | /* ^C or SIGINT: repeat */ |
2424 | /* bash prints ^C even on real SIGINT (non-kbd generated) */ | ||
2425 | write(STDOUT_FILENO, "^C", 2); | ||
2426 | G.last_exitcode = 128 + SIGINT; | 2426 | G.last_exitcode = 128 + SIGINT; |
2427 | } | 2427 | } |
2428 | if (r < 0) { | 2428 | if (r < 0) { |