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. > # stdout to {stdout}, stderr to $errors > errors=$("$@" 2>&1 1>&${stdout}) > ret=$? > printf '%s\n' "$errors" >&2 (Previous version did this any my suggestion was to change it ...) > ? Or something like that (for example I'm not sure if you need the \n). Trying to improve the original solution, What about a bit more understandable errors=$("${@}" 2> >(tee >(cat) >&2) >&$stdout) ? Which gets rid of some redirections and PIPESTATUS. > In either case, stdout and stderr can be mixed. Yes, we can't have a good solution here. >> + temp_file RUNTIME_arch_run <(echo "#!/bin/bash"; cat scripts/arch-run.bash "$TEST_DIR/run") > > Please use a pipe instead of a <(...): (Is it for aesthetic reasons?) Thanks. -- 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