On Wed, Sep 07, 2016 at 11:39:57AM -0700, Junio C Hamano wrote:
> > Can we do some signaling with fifos to tell the hook when it is safe to
> > exit? Then we would just need to `wait` for its parent process.
> Is fifo safe on Windows, though?
No clue. We seem to use mkfifo unconditionally in lib-daemon, but
perhaps people do not run that test on Windows. Other invocations seem
to be protected by the PIPE prerequisite. But...
> With v2 that explicitly kills, I guess we can make the sleep longer
> without slowing down in the optimistic case?
Yeah, I think the v2 one is non-racy (I thought at first we might race
with the "echo", but it should be synchronous; the hook will not exit
until we have written the pid file, and git will not exit until the hook
is done running).
I agree that the sleep could be made longer, to make the test less racy.
However, the racy failure mode is that it might pass while testing
nothing (i.e., the sleep ends anyway before the hook returns), so I
don't think it's a high priority.