tests: make the 'test_pause' helper work in non-verbose mode
When the 'test_pause' helper function invokes the shell mid-test, it explicitly redirects the shell's stdout and stderr to file descriptors 3 and 4, which are the stdout and stderr of the tests (i.e. where they would be connected anyway without those redirections). These file descriptors are only attached to the terminal in verbose mode, hence the restriction of 'test_pause' to work only with '-v'. Redirect the shell's stdout and stderr to the test environment's original stdout and stderr, allowing it to work properly even in non-verbose mode, and the restriction can be lifted. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Mar 18, 2017 at 17:14 UTC
59210dd56c25a06a3ec562a07571a96b438e7362
1 file changed
+2
-7
t/test-lib-functions.sh
+2
-7
@@ -136,17 +136,12 @@ test_tick () {
136
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
137
}
138
139
-# Stop execution and start a shell. This is useful for debugging tests and
140
-# only makes sense together with "-v".
139
+# Stop execution and start a shell. This is useful for debugging tests.
140
#
141
# Be sure to remove all invocations of this command before submitting.
142
143
test_pause () {
145
- if test "$verbose" = t; then
146
- "$SHELL_PATH" <&6 >&3 2>&4
147
- else
148
- error >&5 "test_pause requires --verbose"
149
- fi
144
+ "$SHELL_PATH" <&6 >&5 2>&7
145
}
146
147
# Wrap git in gdb. Adding this to a command can make it easier to