diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index fda167b0cfa2..ea8c8f809909 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -1062,6 +1062,7 @@ dowait(int block, struct job *job) if (coredump) out1str(" (core dumped)"); out1c('\n'); + flushout(out1); } } else { TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job)); diff --git a/tools/regression/bin/sh/execution/killed1.0 b/tools/regression/bin/sh/execution/killed1.0 new file mode 100644 index 000000000000..41d3e055723e --- /dev/null +++ b/tools/regression/bin/sh/execution/killed1.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ +# Sometimes the "Killed" message is not flushed soon enough and it +# is redirected along with the output of a builtin. +# Do not change the semicolon to a newline as it would hide the bug. + +exec 3>&1 +exec >/dev/null 2>&1 +${SH} -c 'kill -9 $$'; : >&3 2>&3