]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t9300-fast-import: store the PID in a variable instead of pidfile
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 6 Dec 2019 19:03:30 +0000 (20:03 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2019 19:45:57 +0000 (11:45 -0800)
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>
t/t9300-fast-import.sh

index e707fb861e14ed66b7cc524ab02513eafec74fca..6820ebbb6378be715a1f4e892355b5de179f92a3 100755 (executable)
@@ -3165,12 +3165,12 @@ background_import_then_checkpoint () {
        rm V.output
 
        git fast-import $options <&8 >&9 &
-       echo $! >V.pid
+       fi_pid=$!
        # We don't mind if fast-import has already died by the time the test
        # ends.
        test_when_finished "
                exec 8>&-; exec 9>&-;
-               kill $(cat V.pid) && wait $(cat V.pid)
+               kill $fi_pid && wait $fi_pid
                true"
 
        # Start in the background to ensure we adhere strictly to (blocking)
@@ -3202,7 +3202,7 @@ background_import_then_checkpoint () {
 }
 
 background_import_still_running () {
-       if ! kill -0 "$(cat V.pid)"
+       if ! kill -0 "$fi_pid"
        then
                echo >&2 "background fast-import terminated too early"
                false