Subject: Re: [PATCH 10/11] t5570: make test "set -e" clean

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 25 Mar 2026 08:16:07 +0100

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.

Patrick