Re: [PATCH/RFC 3/3] upload-archive: use start_command instead of fork
From: Jeff King <hidden>
Date: 2016-06-15 22:51:33
On Fri, Jul 08, 2011 at 12:37:48AM +0200, Erik Faye-Lund wrote:
quoted
Yeah, exactly. The current code is already using dup2 in the same way.It does, but I'm not entirely sure how dup2 works when start_async is implemented with threads. Won't cause the multiplexer to fail (the multiplexer and the archive-thread needs different stdouts), because file descriptors are process-resources, and not thread-resources?
Oh, right. I'm being a moron. Sorry.
I guess I could dup stdout/stderr before dup2'ing, and have the multiplexer write to explicitly to the duped fds. It's starting to sound very confusing to my ears, but perhaps it's the best option still ;)
Yes, you would have to dup stdout in the muxer to a new fd, then write to that explicitly. And then you would be free to dup the write half of the async pipe to stdout. It's not all that complicated, but maybe it is simpler and more obvious (especially to a later reader of the code) to just run a separate command. -Peff