git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 3/4] t/lib-git-p4: silence output when killing p4d and its watchdog

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 3, 2026, 05:39 UTC
Message-ID
<20260603-pks-t7527-fix-tap-output-v2-3-cf3af5694e20@pks.im>
In-Reply-To
<20260603-pks-t7527-fix-tap-output-v2-0-cf3af5694e20@pks.im>

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>
---
 t/lib-git-p4.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index d22e9c684a..9108868187 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -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"
 }
 
-- 
2.54.0.1064.gd145956f57.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 4 of 5 in “t: fix broken TAP output”
  1. 0/4 t: fix broken TAP outputPatrick Steinhardt, Jun 3, 2026
  2. 1/4 t7527: fix broken TAP outputPatrick Steinhardt, Jun 3, 2026
  3. 2/4 t/test-lib: silence EBUSY errors on Windows during test cleanupPatrick Steinhardt, Jun 3, 2026
  4. 3/4 t/lib-git-p4: silence output when killing p4d and its watchdogPatrick Steinhardt, Jun 3, 2026
  5. 4/4 t: let prove fail when parsing invalid TAP outputPatrick Steinhardt, Jun 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.