diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-10-24 03:33:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-10-24 03:33:32 +0200 |
commit | b65d6cb00fa0ea51bac4c4e62b576b43ae2c996b (patch) | |
tree | e1d18236b70a031d50f7cdeaf8de501394911e22 | |
parent | 079487b48724d936b31a6696ae0f929b0251eaa3 (diff) | |
download | busybox-w32-b65d6cb00fa0ea51bac4c4e62b576b43ae2c996b.tar.gz busybox-w32-b65d6cb00fa0ea51bac4c4e62b576b43ae2c996b.tar.bz2 busybox-w32-b65d6cb00fa0ea51bac4c4e62b576b43ae2c996b.zip |
hush: do not print killing signal name in `cmd_whihc_dies_on_signal`
function old new delta
process_wait_result 438 449 +11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 8 | ||||
-rw-r--r-- | shell/hush_test/hush-psubst/tick6.right | 1 | ||||
-rwxr-xr-x | shell/hush_test/hush-psubst/tick6.tests | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index e9cec1cc9..2b34b7da5 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -8698,9 +8698,15 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status) | |||
8698 | */ | 8698 | */ |
8699 | if (WIFSIGNALED(status)) { | 8699 | if (WIFSIGNALED(status)) { |
8700 | int sig = WTERMSIG(status); | 8700 | int sig = WTERMSIG(status); |
8701 | if (i == fg_pipe->num_cmds-1) | 8701 | if (G.run_list_level == 1 |
8702 | /* ^^^^^ Do not print in nested contexts, example: | ||
8703 | * echo `sleep 1; sh -c 'kill -9 $$'` - prints "137", NOT "Killed 137" | ||
8704 | */ | ||
8705 | && i == fg_pipe->num_cmds-1 | ||
8706 | ) { | ||
8702 | /* TODO: use strsignal() instead for bash compat? but that's bloat... */ | 8707 | /* TODO: use strsignal() instead for bash compat? but that's bloat... */ |
8703 | puts(sig == SIGINT || sig == SIGPIPE ? "" : get_signame(sig)); | 8708 | puts(sig == SIGINT || sig == SIGPIPE ? "" : get_signame(sig)); |
8709 | } | ||
8704 | /* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */ | 8710 | /* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */ |
8705 | /* TODO: MIPS has 128 sigs (1..128), what if sig==128 here? | 8711 | /* TODO: MIPS has 128 sigs (1..128), what if sig==128 here? |
8706 | * Maybe we need to use sig | 128? */ | 8712 | * Maybe we need to use sig | 128? */ |
diff --git a/shell/hush_test/hush-psubst/tick6.right b/shell/hush_test/hush-psubst/tick6.right new file mode 100644 index 000000000..065fd3e79 --- /dev/null +++ b/shell/hush_test/hush-psubst/tick6.right | |||
@@ -0,0 +1 @@ | |||
137 | |||
diff --git a/shell/hush_test/hush-psubst/tick6.tests b/shell/hush_test/hush-psubst/tick6.tests new file mode 100755 index 000000000..33dd3630d --- /dev/null +++ b/shell/hush_test/hush-psubst/tick6.tests | |||
@@ -0,0 +1 @@ | |||
true; echo `sh -c 'kill -9 $$'` $? | |||