git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC 3/3] upload-archive: use start_command instead of fork

From
Jeff King <peff@peff.net>
Date
Jul 7, 2011, 22:44 UTC
Message-ID
<20110707224427.GB23273@sigill.intra.peff.net>
In-Reply-To
<CABPQNSbUx3Z-JCsr1rpjqEvKHSoOLnRP3f7pN6cMfNEiNoZBhg@mail.gmail.com>
On Fri, Jul 08, 2011 at 12:37:48AM +0200, Erik Faye-Lund wrote:
Show 6 quoted lines
> > 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
Previous: Erik Faye-Lund
Message 11 of 11 in “port upload-archive to windows”
  1. 0/3 port upload-archive to windowsErik Faye-Lund, Jul 7, 2011
  2. 1/3 compat/win32/sys/poll.c: upgrade from upstreamErik Faye-Lund, Jul 7, 2011
  3. 2/3 mingw: fix compilation of poll-emulationErik Faye-Lund, Jul 7, 2011
  4. 3/3 upload-archive: use start_command instead of forkErik Faye-Lund, Jul 7, 2011
  5. Johannes SixtJul 7, 2011
  6. Erik Faye-LundJul 7, 2011
  7. Jeff KingJul 7, 2011
  8. Erik Faye-LundJul 7, 2011
  9. Jeff KingJul 7, 2011
  10. Erik Faye-LundJul 7, 2011
  11. Jeff KingJul 7, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.