From: Junio C Hamano Date: Wed, 25 Mar 2026 15:50:13 GMT Subject: Re: [PATCH 10/11] t5570: make test "set -e" clean Message-ID: In-Reply-To: Patrick Steinhardt writes: > On Tue, Mar 24, 2026 at 11:21:13PM -0700, Junio C Hamano wrote: >> diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh >> index e62569222b..6850f08c1d 100644 >> --- a/t/lib-git-daemon.sh >> +++ b/t/lib-git-daemon.sh >> @@ -86,13 +86,13 @@ stop_git_daemon() { >> # kill git-daemon child of git >> say >&3 "Stopping git daemon ..." >> kill "$GIT_DAEMON_PID" >> - wait "$GIT_DAEMON_PID" >&3 2>&4 >> - ret=$? >> + ret=0 >> + wait "$GIT_DAEMON_PID" >&3 2>&4 || ret=$? >> if ! test_match_signal 15 $ret >> then >> error "git daemon exited with status: $ret" >> fi >> - kill "$(cat "$GIT_DAEMON_PIDFILE")" 2>/dev/null >> + kill "$(cat "$GIT_DAEMON_PIDFILE")" 2>/dev/null || : >> GIT_DAEMON_PID= >> rm -f git_daemon_output "$GIT_DAEMON_PIDFILE" >> } > > This test actually made me pause a bit. In theory, you can use the > function to verify that git-daemon(1) exits successfully because we do > bubble up its exit code. So instead of silencing the error code, I > simply added `|| :` to all callsites that don't care about it at all. > > But in practice, that turned out to be every callsite, so that exercise > may not be worth it. Yeah. Worse, I think this is called even when I suspect that the daemon is in the process of exiting (i.e., racy), has already exited (i.e., kill and wait will say "huh? what are you talking about"), or simply when we do not know what status it is in, so I think it is OK to ignore errors from these.