From e8df4cd32143bc452f5518a81714c76cc0577530 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 3 Feb 2025 18:26:56 -0500 Subject: [PATCH] tap: minimize stderr redirection to just the test script * lib/tap-driver.sh: Keep driver stderr separate from test script stderr to aid with debugging (e.g., `set -x'). --- lib/tap-driver.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh index 0bd79a6d4..2e30ec3b1 100755 --- a/lib/tap-driver.sh +++ b/lib/tap-driver.sh @@ -23,7 +23,7 @@ # bugs to or send patches to # . -scriptversion=2025-02-03.01; # UTC +scriptversion=2025-02-03.02; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. @@ -139,12 +139,17 @@ fi # # trap : 1 3 2 13 15 + # Determine where to send the test script's stderr. Only the test's stderr + # should go here; if `exec 2>&$stderr_fd' were run, this script's stderr + # (e.g., `set -x' output, if turned on to help with debugging) would mix + # with the test script's stderr and go to the log (via `awk', if `--merge' + # is enabled), not the terminal. if test $merge -gt 0; then - exec 2>&1 + stderr_fd=1 # send stderr to awk, which will copy it to the log else - exec 2>&3 + stderr_fd=3 # send stderr directly to the log file fi - "$@" 3>&- + "$@" 2>&$stderr_fd 3>&- echo $? ) | LC_ALL=C ${AM_TAP_AWK-awk} \ -v me="$me" \ -- 2.47.3