summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/t9300-fast-import.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 6820ebbb63..8f6f80f021 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -3164,12 +3164,21 @@ background_import_then_checkpoint () {
exec 9<>V.output
rm V.output
- git fast-import $options <&8 >&9 &
- fi_pid=$!
+ (
+ git fast-import $options <&8 >&9 &
+ echo $! >&9
+ wait $!
+ echo >&2 "background fast-import terminated too early with exit code $?"
+ # Un-block the read loop in the main shell process.
+ echo >&9 UNEXPECTED
+ ) &
+ sh_pid=$!
+ read fi_pid <&9
# We don't mind if fast-import has already died by the time the test
# ends.
test_when_finished "
exec 8>&-; exec 9>&-;
+ kill $sh_pid && wait $sh_pid
kill $fi_pid && wait $fi_pid
true"
@@ -3190,6 +3199,9 @@ background_import_then_checkpoint () {
then
error=0
break
+ elif test "$output" = "UNEXPECTED"
+ then
+ break
fi
# otherwise ignore cruft
echo >&2 "cruft: $output"