From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH] scripts/arch-run: print stderr immediately Date: Thu, 3 Nov 2016 13:38:18 +0100 Message-ID: <7f385e31-cf44-758d-9d81-5151823b5395@redhat.com> References: <20161102205029.880-1-rkrcmar@redhat.com> <20161102210548.vwzhlrrv7qd6vuba@kamzik.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org To: Andrew Jones , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:32932 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754285AbcKCMiW (ORCPT ); Thu, 3 Nov 2016 08:38:22 -0400 Received: by mail-wm0-f65.google.com with SMTP id u144so7836022wmu.0 for ; Thu, 03 Nov 2016 05:38:22 -0700 (PDT) In-Reply-To: <20161102210548.vwzhlrrv7qd6vuba@kamzik.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 02/11/2016 22:05, Andrew Jones wrote: > On Wed, Nov 02, 2016 at 09:50:29PM +0100, Radim Krčmář wrote: >> Not doing so hid stderr output when the test was stuck and subsequently >> killed with ^C. >> >> Signed-off-by: Radim Krčmář >> --- >> scripts/arch-run.bash | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash >> index 8e75c6ed6e17..326f59484e2b 100644 >> --- a/scripts/arch-run.bash >> +++ b/scripts/arch-run.bash >> @@ -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}) 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 > > Lovely... > > The comment above could have been changed to > > # ... stderr to stdout and $errors > >> 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") >> -- >> 2.10.1 > > Reviewed-by: Andrew Jones > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >