t9300-fast-import: store the PID in a variable instead of pidfile
The five tests running 'git fast-import' in the background in 't9300-fast-import.sh' store the PID of that background process in a pidfile, to be used to check whether that background process survived each test and then to kill it in test_when_finished commands. To achieve this all these five tests run three $(cat <pidfile>) command substitutions each. Store the PID of the background 'git fast-import' in a variable to avoid those extra processes. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Dec 6, 2019 at 20:03 UTC
21f57620b2e73d20f5c98006af756e0162eaee3b
1 file changed
+3
-3
t/t9300-fast-import.sh
+3
-3
@@ -3165,12 +3165,12 @@ background_import_then_checkpoint () {
3165
rm V.output
3166
3167
git fast-import $options <&8 >&9 &
3168
- echo $! >V.pid
3168
+ fi_pid=$!
3169
# We don't mind if fast-import has already died by the time the test
3170
# ends.
3171
test_when_finished "
3172
exec 8>&-; exec 9>&-;
3173
- kill $(cat V.pid) && wait $(cat V.pid)
3173
+ kill $fi_pid && wait $fi_pid
3174
true"
3175
3176
# Start in the background to ensure we adhere strictly to (blocking)
@@ -3202,7 +3202,7 @@ background_import_then_checkpoint () {
3202
}
3203
3204
background_import_still_running () {
3205
- if ! kill -0 "$(cat V.pid)"
3205
+ if ! kill -0 "$fi_pid"
3206
then
3207
echo >&2 "background fast-import terminated too early"
3208
false