2016-03-02 15:44+0100, Paolo Bonzini: > On 02/03/2016 13:57, Radim Krčmář wrote: >> 2016-03-01 22:29+0100, Paolo Bonzini: >>> On 29/02/2016 19:53, Andrew Jones wrote: >>>> + errors=$("${@}" 2>&1 1>&${stdout} | tee >(cat - 1>&2); exit ${PIPESTATUS[0]}) >>> >>> Whoa! :) So stdout goes to {stdout} and from there to the real stdout; >>> stderr instead is tee'd to stderr and $errors. >> >> Yeah. :) >> >>> Is the "tee" and "cat" necessary? Can you just use printf somewhat like: >> >> They are, if you want want to improve chances of getting the original >> order of stdout and stderr. > > Getting the original order can't really work if you use separate file > descriptions. Yes, there is no "true" order ... my concern is about transparency: tee delays stderr much less than if we buffered stderr until QEMU has finished, so mixed stdout/stderr has better chance of being visible in sans-wrapper order. > I'm not sure how you would have something on stderr, except on the very > last line? The idea being that 1) the test only writes to stdout 2) > QEMU only writes to stderr 3) QEMU exits after writing to stderr. If > this is true, the proposed assignment/printf pair works just fine. QEMU prints some warnings without immediately exiting, e.g. warning: host doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5] So it's possible that stdout is printed after stderr. Preserving the visible output could be less confusing in these rare cases. I agree with the late printf if you think that the ugly code is not worth it. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html