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>
This commit is contained in:
parent
079487b487
commit
b65d6cb00f
@ -8698,9 +8698,15 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status)
|
|||||||
*/
|
*/
|
||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
int sig = WTERMSIG(status);
|
int sig = WTERMSIG(status);
|
||||||
if (i == fg_pipe->num_cmds-1)
|
if (G.run_list_level == 1
|
||||||
|
/* ^^^^^ Do not print in nested contexts, example:
|
||||||
|
* echo `sleep 1; sh -c 'kill -9 $$'` - prints "137", NOT "Killed 137"
|
||||||
|
*/
|
||||||
|
&& i == fg_pipe->num_cmds-1
|
||||||
|
) {
|
||||||
/* TODO: use strsignal() instead for bash compat? but that's bloat... */
|
/* TODO: use strsignal() instead for bash compat? but that's bloat... */
|
||||||
puts(sig == SIGINT || sig == SIGPIPE ? "" : get_signame(sig));
|
puts(sig == SIGINT || sig == SIGPIPE ? "" : get_signame(sig));
|
||||||
|
}
|
||||||
/* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */
|
/* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */
|
||||||
/* TODO: MIPS has 128 sigs (1..128), what if sig==128 here?
|
/* TODO: MIPS has 128 sigs (1..128), what if sig==128 here?
|
||||||
* Maybe we need to use sig | 128? */
|
* Maybe we need to use sig | 128? */
|
||||||
|
1
shell/hush_test/hush-psubst/tick6.right
Normal file
1
shell/hush_test/hush-psubst/tick6.right
Normal file
@ -0,0 +1 @@
|
|||||||
|
137
|
1
shell/hush_test/hush-psubst/tick6.tests
Executable file
1
shell/hush_test/hush-psubst/tick6.tests
Executable file
@ -0,0 +1 @@
|
|||||||
|
true; echo `sh -c 'kill -9 $$'` $?
|
Loading…
x
Reference in New Issue
Block a user