scripts/arch-run: print stderr immediately
PATCH 1/1 scripts/arch-run: print stderr immediately
Not doing so hid stderr output when the test was stuck and subsequently killed with ^C.
--- scripts/arch-run.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/arch-run.bash +1 -2
@@ -30,12 +30,11 @@ run_qemu () # stdout to {stdout}, stderr to $errors exec {stdout}>&1 - errors=$("${@}" 2>&1 1>&${stdout}) + errors=$("${@}" 2> >(tee >(cat) >&2) 1>&${stdout}) ret=$? exec {stdout}>&- if [ "$errors" ]; then - printf "%s\n" "$errors" >&2 sig=$(grep 'terminating on signal' <<<"$errors") if [ "$sig" ]; then sig=$(sed 's/.*terminating on signal \([0-9][0-9]*\).*/\1/' <<<"$sig")
Signature · 1 line
2.10.1
Quoted 13 lines · Radim Krčmář
Not doing so hid stderr output when the test was stuck and subsequently killed with ^C.
Signed-off-by Radim Krčmář <[email protected]>--- scripts/arch-run.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)scripts/arch-run.bash +0
-0
scripts/arch-run.bash run_qemu () · line 33
Quoted 5 lines
scripts/arch-run.bash +1
-1@@ -30,12 +30,11 @@ run_qemu () # stdout to {stdout}, stderr to $errors exec {stdout}>&1 - errors=$("${@}" 2>&1 1>&${stdout}) + errors=$("${@}" 2> >(tee >(cat) >&2) 1>&${stdout})
Lovely...
The comment above could have been changed to
# ... stderr to stdout and $errors
Quoted 10 lines
scripts/arch-run.bash +0
-1ret=$? exec {stdout}>&- if [ "$errors" ]; then - printf "%s\n" "$errors" >&2 sig=$(grep 'terminating on signal' <<<"$errors") if [ "$sig" ]; then sig=$(sed 's/.*terminating on signal \([0-9][0-9]*\).*/\1/' <<<"$sig")Signature · 1 line
2.10.1
Paolo Bonzini
maintainerQuoted 15 lines · Andrew Jones
Quoted 14 lines · Radim Krčmář
Not doing so hid stderr output when the test was stuck and subsequently killed with ^C.
Signed-off-by Radim Krčmář <[email protected]>--- scripts/arch-run.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)scripts/arch-run.bash +0
-0@@ -30,12 +30,11 @@ run_qemu ()
Quoted 4 lines
scripts/arch-run.bash run_qemu () · line 33
Quoted 4 lines
scripts/arch-run.bash +1
-1# stdout to {stdout}, stderr to $errors exec {stdout}>&1 - errors=$("${@}" 2>&1 1>&${stdout}) + errors=$("${@}" 2> >(tee >(cat) >&2) 1>&${stdout})
What about:
# preserve stdout and stderr output, but save stderr to $errors
exec {stdout}>&1 {stderr}>&2
errors=$("$@" 2> >(tee /dev/fd/$stderr) > /dev/fd/$stdout)
exec {stdout}>&- {stderr}>&-(Tested in the shell but not in arch-run.bash).
Paolo
Quoted 24 lines
Lovely...
The comment above could have been changed to
# ... stderr to stdout and $errorsQuoted 10 lines
scripts/arch-run.bash +0
-1ret=$? exec {stdout}>&- if [ "$errors" ]; then - printf "%s\n" "$errors" >&2 sig=$(grep 'terminating on signal' <<<"$errors") if [ "$sig" ]; then sig=$(sed 's/.*terminating on signal \([0-9][0-9]*\).*/\1/' <<<"$sig")Signature · 1 line
2.10.1Reviewed-by Andrew Jones <[email protected]>--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
2016-11-03 13:38+0100, Paolo Bonzini:
Quoted 23 lines · Andrew Jones
Quoted 15 lines · Radim Krčmář
Quoted 14 lines
Not doing so hid stderr output when the test was stuck and subsequently killed with ^C.
Signed-off-by Radim Krčmář <[email protected]>--- scripts/arch-run.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)scripts/arch-run.bash +0
-0@@ -30,12 +30,11 @@ run_qemu ()Quoted 4 lines
scripts/arch-run.bash run_qemu () · line 33
Quoted 4 lines
scripts/arch-run.bash +1
-1# stdout to {stdout}, stderr to $errors exec {stdout}>&1 - errors=$("${@}" 2>&1 1>&${stdout}) + errors=$("${@}" 2> >(tee >(cat) >&2) 1>&${stdout})What about:
Quoted 6 lines
# preserve stdout and stderr output, but save stderr to $errors exec {stdout}>&1 {stderr}>&2 errors=$("$@" 2> >(tee /dev/fd/$stderr) > /dev/fd/$stdout) exec {stdout}>&- {stderr}>&-(Tested in the shell but not in arch-run.bash).
Using files looks nicer, but is there a problem in the redirection? I would rather use /dev/stderr or /dev/fd/2 directly if not.
i.e.
exec {stdout}>&1
errors=$("$@" 2> >(tee /dev/stderr) > /dev/fd/$stdout) exec {stdout}>&-
Paolo Bonzini
maintainerQuoted 31 lines · Radim Krčmář
2016-11-03 13:38+0100, Paolo Bonzini:
Quoted 23 lines · Andrew Jones
Quoted 15 lines · Radim Krčmář
Quoted 14 lines
Not doing so hid stderr output when the test was stuck and subsequently killed with ^C.
Signed-off-by Radim Krčmář <[email protected]>--- scripts/arch-run.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)scripts/arch-run.bash +0
-0@@ -30,12 +30,11 @@ run_qemu ()Quoted 4 lines
scripts/arch-run.bash run_qemu () · line 33
Quoted 4 lines
scripts/arch-run.bash +1
-1# stdout to {stdout}, stderr to $errors exec {stdout}>&1 - errors=$("${@}" 2>&1 1>&${stdout}) + errors=$("${@}" 2> >(tee >(cat) >&2) 1>&${stdout})What about:
Quoted 6 lines
# preserve stdout and stderr output, but save stderr to $errors exec {stdout}>&1 {stderr}>&2 errors=$("$@" 2> >(tee /dev/fd/$stderr) > /dev/fd/$stdout) exec {stdout}>&- {stderr}>&-(Tested in the shell but not in arch-run.bash).
Quoted 7 lines
Using files looks nicer, but is there a problem in the redirection? I would rather use
/dev/stderror/dev/fd/2directly if not.i.e.
exec {stdout}>&1
errors=$("$@" 2> >(tee/dev/stderr) >/dev/fd/$stdout) exec {stdout}>&-
Yes, this works too.
Paolo