Hi Peff & Junio,
On Wed, 7 Sep 2016, Jeff King wrote:
> 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...
AFAICT we do not use mkfifo on Windows. Let's see what t/test-lib.sh has
to say about the matter:
test_lazy_prereq PIPE '
# test whether the filesystem supports FIFOs
case $(uname -s) in
rm -f testfifo && mkfifo testfifo
So there you go.
The reason it is disabled is that Cygwin/MSYS2 do have a concept of a
FIFO. But `git.exe` won't be able to access such a FIFO because it is
emulated by the POSIX emulation layer, which Git cannot access.
> > 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).
Please note that Hannes and I discussed this (as I originally suggested to
increase it to 10 seconds, and Hannes rightfully pointed out that we would
have to change the script name, too, as it says sleep-one-second.sh, and
that would have made the patch less readable) and we came to the same
conclusion: it's not necessary.