Am 6/5/2012 8:56, schrieb Jeff King: > On Mon, Jun 04, 2012 at 07:20:55PM +0200, Florian Achleitner wrote: >> +static int fd_to_close; >> +void close_fd_prexec_cb(void) >> +{ >> + if(debug) >> + fprintf(stderr, "close_fd_prexec_cb closing %d\n", fd_to_close); >> + close(fd_to_close); >> +} > > Note that preexec_cb does not work at all on Windows, as it assumes a > forking model (rather than a spawn, which leaves no room to execute > arbitrary code in the child). If all you want to do is open an extra > pipe, then probably run-command should be extended to handle this > (though I have no idea how complex that would be for the Windows side of > things, it is at least _possible_, as opposed to preexec_cb, which will > never be possible). The lack of support for preexec_cb on Windows is actually not the problem in this case. Our emulation of pipe() actually creates file handles that are not inherited by child processes. (For the standard channels 0,1,2 we rely on that dup() creates duplicates that *can* be inherited; so they still work.) The first problem with the new infrastructure in this patch is that dup() is not called anywhere after pipe(). To solve this, we would have to extend run-command in some way to allow passing along arbitrary pipes and handles. The second problem is more severe and is at the lowest level of our infrastructure: We set up our child processes so that they know only about file descriptors other than 0,1,2 to the child process. Even if the first problem were solved, the child process does not receive sufficient information to know that there are open file descriptors other than 0,1,2. There is a facility to pass along this information from the parent to the child, but we simply do not implement it. IOW: Everything that uses --cat-blob-fd or a similar facility cannot work on Windows without considerable additional effort. -- Hannes -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html