We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad3b159 commit e82402fCopy full SHA for e82402f
1 file changed
libexec/bats-core/bats
@@ -485,16 +485,7 @@ bats_tee() { # <output-file> <command...>
485
local output_file=$1 status=0
486
shift
487
exec 3<&1 # use FD3 to get around pipe
488
- {
489
- while IFS= read -r line; do
490
- printf "%s\n" "$line" || exit 1 # write to command/file
491
- printf "%s\n" "$line" >&3 # write to our stdout
492
- done
493
- if [[ -n "$line" ]]; then
494
- printf "%s\n" "$line" # write to command/file
495
496
- fi
497
- } | "$@" >"$output_file" || status=$?
+ tee >(cat >&3) | "$@" >"$output_file" || status=$?
498
if (( status != 0 )); then
499
printf "ERROR: command \`%s\` failed with status %d\n" "$*" "$status" >&2
500
fi
0 commit comments