Re: [PATCH 1/2] daemon: add tests
- From
Jeff King <peff@peff.net>
- Date
- Jan 5, 2012, 02:55 UTC
- Message-ID
- <20120105025559.GB7326@sigill.intra.peff.net>
- In-Reply-To
- <20120105000713.GA24220@ecki.lan>
On Thu, Jan 05, 2012 at 01:07:13AM +0100, Clemens Buchacher wrote:
Show 9 quoted lines
> On Wed, Jan 04, 2012 at 05:26:49PM -0500, Jeff King wrote: > > > > Or is the problem the git wrapper itself, which doesn't kill its > > subprocess when it dies (which IMHO is a bug which we might want to > > fix)? In that case, couldn't we just use --pid-file to save the actual > > daemon pid, and then kill using that? > > Or like this. Doesn't work with multiple children. I have yet to > check if we have those anywhere.
It so happens that I have just the patch you need. I've been meaning to go over it again and submit it:
run-command: optionally kill children on exit https://github.com/peff/git/commit/5523d7ebf2a0386c9c61d7bfbc21375041df4989
The original use case was to help with this:
https://github.com/peff/git/commit/79bf3f232f89c3e2f5284a3b7b71a667be8825d1
Show 7 quoted lines
> > As a side note, it looks like we just start the daemon with "git daemon > > &". Doesn't that create a race condition with the tests which > > immediately try to access it (i.e., the first test may run before the > > daemon actually opens the socket)? > > That's correct. How would I fix that? Try connecting and sleep in a > loop until ready or timeout? Will look into that.
Your choices are basically busy-waiting, or convincing the daemon to send a signal when it's ready to serve. I like the latter, but it does mean adding a small amount of code to git-daemon.
-Peff