Skip to content

Commit a5adcbe

Browse files
Clemens Buchachergitster
authored andcommitted
test-lib: fix http exit codes
Previously, die() would report the exit code of stop_httpd. Instead, save and reset the exit code before dying. Signed-off-by: Clemens Buchacher <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e7b5aa commit a5adcbe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/lib-httpd.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,16 @@ prepare_httpd() {
9393
start_httpd() {
9494
prepare_httpd >&3 2>&4
9595

96-
trap 'stop_httpd; die' EXIT
96+
trap 'code=$?; stop_httpd; (exit $code); die' EXIT
9797

9898
"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
9999
-f "$TEST_PATH/apache.conf" $HTTPD_PARA \
100100
-c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start \
101101
>&3 2>&4
102-
if ! test $? = 0; then
102+
if test $? -ne 0
103+
then
103104
say "skipping test, web server setup failed"
105+
trap 'die' EXIT
104106
test_done
105107
fi
106108
}

0 commit comments

Comments
 (0)