t/lib-git-p4: silence output when killing p4d and its watchdog

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>

Patrick Steinhardt committed Jun 4, 2026 at 12:07 UTC c2d2d173ae6ba4b354a36b3ba732c8a11379d6ec
1 file changed +2 -2
t/lib-git-p4.sh
+2 -2
@@ -65,6 +65,7 @@ pidfile="$TRASH_DIRECTORY/p4d.pid"
65
66 stop_p4d_and_watchdog () {
67 kill -9 $p4d_pid $watchdog_pid
68 + wait $p4d_pid $watchdog_pid 2>/dev/null
69 }
70
71 # git p4 submit generates a temp file, which will
@@ -174,8 +175,7 @@ retry_until_success () {
175 }
176
177 stop_and_cleanup_p4d () {
177 - kill -9 $p4d_pid $watchdog_pid
178 - wait $p4d_pid
178 + stop_p4d_and_watchdog
179 rm -rf "$db" "$cli" "$pidfile"
180 }
181