Re: [PATCH] t5570: forward git-daemon messages in a different way
- From
Clemens Buchacher <drizzd@aon.at>
- Date
- Apr 26, 2012, 19:55 UTC
- Message-ID
- <20120426195503.GA29526@ecki>
- In-Reply-To
- <4F999105.200@kdbg.org>
On Thu, Apr 26, 2012 at 08:16:37PM +0200, Johannes Sixt wrote:
Show 22 quoted lines
>
> @@ -30,10 +30,10 @@ start_git_daemon() {
> "$@" "$GIT_DAEMON_DOCUMENT_ROOT_PATH" \
> >&3 2>git_daemon_output &
> GIT_DAEMON_PID=$!
> + exec 7<git_daemon_output &&
> {
> - read line
> + read line <&7
> echo >&4 "$line"
> - cat >&4 &
>
> # Check expected output
> if test x"$(expr "$line" : "\[[0-9]*\] \(.*\)")" != x"Ready to rumble"
> @@ -43,7 +43,9 @@ start_git_daemon() {
> trap 'die' EXIT
> error "git daemon failed to start"
> fi
> - } <git_daemon_output
> + cat <&7 >&4 &
> + exec 7<&-
> + }I won't pretend to understand why this works. I have to study this some more. But if this is 'correct', then it is obviously preferable to the comparatively complicated wrapper.
We should move the cat <&7 >&4 & and exec 7<&- part in front of the output check, otherwise output would be truncated in an error condition. This can be tested by passing an invalid argument to git daemon above, for example.
Clemens