[git commit] ash, hush: print sugnal-related "beautification" (^C etc) to stderr, not stdout
Denys Vlasenko
vda.linux at googlemail.com
Sun Oct 11 13:54:21 UTC 2026
commit: https://git.busybox.net/busybox/commit/?id=049ae38950d17e613f854ace35df76fa4ea89cf8
branch: https://git.busybox.net/busybox/log/?h=master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
shell/ash.c | 6 +++---
shell/hush.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index df7e570a0..2342806d9 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11543,11 +11543,11 @@ preadfd(void)
INTOFF; /* no longjmp'ing out of read_line_input please */
nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ);
if (bb_got_signal == SIGINT)
- write(STDOUT_FILENO, "^C\n", 3);
+ write(STDERR_FILENO, "^C\n", 3);
INTON; /* here non-blocked SIGINT will longjmp */
if (nr == 0) {
/* ^C pressed, "convert" to SIGINT */
- write(STDOUT_FILENO, "^C\n", 3);
+ write(STDERR_FILENO, "^C\n", 3);
raise(SIGINT); /* here non-blocked SIGINT will longjmp */
/* raise(SIGINT) did not work! (e.g. if SIGINT
* is SIG_IGNed on startup, it stays SIG_IGNed)
@@ -11569,7 +11569,7 @@ preadfd(void)
}
else if (errno == EINTR) { /* got signal? */
if (bb_got_signal != SIGINT)
- write(STDOUT_FILENO, "\n", 1);
+ write(STDERR_FILENO, "\n", 1);
goto empty_line_input;
}
# if ENABLE_ASH_IDLE_TIMEOUT
diff --git a/shell/hush.c b/shell/hush.c
index bc8d1e7f7..ac5a01719 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2844,7 +2844,7 @@ static int show_prompt_and_get_stdin(struct in_str *i)
* both on keyboard ^C and on real SIGINT (non-kbd generated).
*/
if (sigismember(&G.pending_set, SIGINT)) {
- write(STDOUT_FILENO, "^C\n", 3);
+ write(STDERR_FILENO, "^C\n", 3);
G.last_exitcode = 128 | SIGINT;
}
check_and_run_traps();
@@ -2855,7 +2855,7 @@ static int show_prompt_and_get_stdin(struct in_str *i)
if (!bb_got_signal) {
/* r < 0: ^D/EOF/error detected (but not signal) */
/* ^D on interactive input goes to next line before exiting: */
- write(STDOUT_FILENO, "\n", 1);
+ write(STDERR_FILENO, "\n", 1);
i->p = NULL;
i->peek_buf[0] = r = EOF;
return r;
@@ -2895,7 +2895,7 @@ static int show_prompt_and_get_stdin(struct in_str *i)
/* ^C or SIGINT: repeat */
/* bash prints ^C even on real SIGINT (non-kbd generated) */
/* kernel prints "^C" itself, just print newline: */
- write(STDOUT_FILENO, "\n", 1);
+ write(STDERR_FILENO, "\n", 1);
G.last_exitcode = 128 | SIGINT;
}
}
More information about the busybox-cvs
mailing list