]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/lib-git-p4: silence output when killing p4d and its watchdog
authorPatrick Steinhardt <ps@pks.im>
Wed, 3 Jun 2026 05:39:46 +0000 (07:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Jun 2026 07:38:04 +0000 (16:38 +0900)
When stopping the p4d watchdog process via "kill -9", the shell may
print a job-control notification like:

  ./test-lib.sh: line 1269: 57960 Killed: 9               while true; do
      if test $nr_tries_left -eq 0; then
          kill -9 $p4d_pid; exit 1;
      fi; sleep 1; nr_tries_left=$(($nr_tries_left - 1));
  done 2> /dev/null 4>&2  (wd: ~)

This message is printed asynchronously by the shell when it reaps the
process. While harmless right now, this will cause breakage once we
enable strict parsing of the TAP protocol in a subsequent commit.

Fix this by using `wait` so that we can synchronously reap the watchdog
process and swallow the diagnostic.

While at it, deduplicate the logic we have in `stop_p4d_and_watchdog ()`
and `stop_and_cleanup_p4d ()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-git-p4.sh

index d22e9c684a495ae3f31b51de2ef29320cf7c049d..910886818768f093e72f4f850a6ff8dfdf17e53a 100644 (file)
@@ -65,6 +65,7 @@ pidfile="$TRASH_DIRECTORY/p4d.pid"
 
 stop_p4d_and_watchdog () {
        kill -9 $p4d_pid $watchdog_pid
+       wait $p4d_pid $watchdog_pid 2>/dev/null
 }
 
 # git p4 submit generates a temp file, which will
@@ -174,8 +175,7 @@ retry_until_success () {
 }
 
 stop_and_cleanup_p4d () {
-       kill -9 $p4d_pid $watchdog_pid
-       wait $p4d_pid
+       stop_p4d_and_watchdog
        rm -rf "$db" "$cli" "$pidfile"
 }