From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH] scripts/arch-run: print stderr immediately
Date: Thu, 3 Nov 2016 13:53:32 +0100 [thread overview]
Message-ID: <20161103125332.GC7771@potion> (raw)
In-Reply-To: <7f385e31-cf44-758d-9d81-5151823b5395@redhat.com>
2016-11-03 13:38+0100, Paolo Bonzini:
> 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ář <rkrcmar@redhat.com>
>>> ---
>>> 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).
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}>&-
next prev parent reply other threads:[~2016-11-03 12:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 20:50 [kvm-unit-tests PATCH] scripts/arch-run: print stderr immediately Radim Krčmář
2016-11-02 21:05 ` Andrew Jones
2016-11-03 12:38 ` Paolo Bonzini
2016-11-03 12:53 ` Radim Krčmář [this message]
2016-11-03 13:32 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161103125332.GC7771@potion \
--to=rkrcmar@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.