Skip to contentSkip to conversation

scripts/arch-run: print stderr immediately

PATCH In review Radim Krčmář 2 participants 3 messages Nov 15, 2016 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scripts/arch-run: print stderr immediately

Not doing so hid stderr output when the test was stuck and subsequently killed with ^C.

---
v2: use /dev/... files instead of &${file descriptor numbers} [Paolo]

---
 scripts/arch-run.bash | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/arch-run.bash +1 -2
index 8e75c6ed6e17..0a1ae95396f9 100644
@@ -30,12 +30,11 @@ run_qemu ()
 
 	# stdout to {stdout}, stderr to $errors
 	exec {stdout}>&1
-	errors=$("${@}" 2>&1 1>&${stdout})
+	errors=$("${@}" 2> >(tee /dev/stderr) > /dev/fd/$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.2
maintainer
#1 lore raw
Quoted 1 line · Radim Krčmář
 	# stdout to {stdout}, stderr to $errors

"stderr to $errors and stderr"

Please make the change and commit it, no need for v3!

Thanks,

Paolo

Quoted 8 lines
scripts/arch-run.bash +1 -2
 	exec {stdout}>&1
-	errors=$("${@}" 2>&1 1>&${stdout})
+	errors=$("${@}" 2> >(tee /dev/stderr) > /dev/fd/$stdout)
 	ret=$?
 	exec {stdout}>&-
 
 	if [ "$errors" ]; then
-		printf "%s\n" "$errors" >&2
#2 lore raw

2016-11-15 15:47+0100, Paolo Bonzini:

Quoted 6 lines · Radim Krčmář
Quoted 1 line
 	# stdout to {stdout}, stderr to $errors

"stderr to $errors and stderr"

Please make the change and commit it, no need for v3!

Bloody comments, thanks!