diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-06-02 08:44:45 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-02 07:51:42 -0700 |
| commit | d411d3d837ece4f29b2a23df0bf537795e2dee56 (patch) | |
| tree | d774d1b043590b0ff53a21d93dcb9fbf411acf22 /t/test-lib.sh | |
| parent | a1199a23896c674f57f3942358e2f05b3a075e7a (diff) | |
| download | git-d411d3d837ece4f29b2a23df0bf537795e2dee56.tar.xz | |
t/test-lib: don't print shell traces to stdout
We have several flags like "--verbose", "--verbose-only" or "-x" that
cause us to generate shell traces. The generated tracing output is split
up in these cases so that the test's stdout is printed to file
descriptor 3 whereas its stderr is printed to file descriptor 4.
Depending on which options have been given, we then end up either:
- Redirecting both file descriptors to a file.
- Redirecting them to stdout and stderr, respectively.
- Closing them in case we're running in none-verbose mode.
The second case causes problems though when passing output to a TAP
parser. We print the test's stdout to the console's stdout, and that
results in broken TAP output.
Fix the issue by instead redirecting the test's stdout to the shell's
stderr. This makes it impossible to discern stdout from stderr, but
going by my own experience I never came across a usecase where I would
have needed this distinction.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
| -rw-r--r-- | t/test-lib.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index af722d383d..6ce8570226 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -707,7 +707,7 @@ then exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3 elif test "$verbose" = "t" then - exec 4>&2 3>&1 + exec 4>&2 3>&2 else exec 4>/dev/null 3>/dev/null fi @@ -949,7 +949,7 @@ maybe_setup_verbose () { test -z "$verbose_only" && return if match_pattern_list $test_count "$verbose_only" then - exec 4>&2 3>&1 + exec 4>&2 3>&2 # Emit a delimiting blank line when going from # non-verbose to verbose. Within verbose mode the # delimiter is printed by test_expect_*. The choice |
