From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Stefan Beller <sbeller@google.com>,
git@vger.kernel.org, peff@peff.net,
johannes.schindelin@gmail.com, Jens.Lehmann@web.de,
ericsunshine@gmail.com, tboegi@web.de
Subject: Re: [PATCH 1/2] run-command: Remove set_nonblocking
Date: Thu, 05 Nov 2015 12:50:33 -0800 [thread overview]
Message-ID: <xmqqa8qs5fxi.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <563BBBBC.7070807@kdbg.org> (Johannes Sixt's message of "Thu, 5 Nov 2015 21:27:40 +0100")
Johannes Sixt <j6t@kdbg.org> writes:
> Am 05.11.2015 um 19:17 schrieb Stefan Beller:
>> strbuf_read_once can also operate on blocking file descriptors if we are
>> sure they are ready. The poll (2) command however makes sure this is the
>> case.
>>
>> Reading the manual for poll (2), there may be spurious returns indicating
>> readiness but that is for network sockets only. Pipes should be unaffected.
>> By having this patch, we rely on the correctness of poll to return
>> only pipes ready to read.
>>
>> This fixes compilation in Windows.
>
> It certainly does (but I haven't tested, yet). But parallel processes
> will not work because we do not have a sufficiently complete waitpid
> emulation, yet. (waitpid(-1, ...) is not implemented.)
>
> However, I think that the infrastructure can be simplified even further
> to a level that we do not need additional emulation on Windows.
;-)
This is why I love this list (and in general not rushing any change
too early to 'next').
> Which makes me think: Other users of start_command/finish_command work
> such that they
>
> 1. request a pipe by setting .out = -1
> 2. start_command
> 3. read from .out until EOF
> 4. close .out
> 5. wait for the process with finish_command
>
> But the parallel_process infrastructure does not follow this pattern.
> It
>
> 1. requests a pipe by setting .err = -1
> 2. start_command
> 3. read from .err
> 4. wait for the process with waitpid
>
> (and forgets to close .err). EOF is not in the picture (but that is
> not essential).
Unrelated tangent. daemon is another one that uses start_command()
but does not use finish_command().
> I suggest to change this such that we read from the children until EOF,
> mark them to be at their end of life, and then wait for them using
> finish_command (assuming that a process that closes stdout and stderr
> will die very soon if it is not already dead).
Hmm, interesting. This does match the normal "spawn, interact and
wait" cycle for a single process much better.
next prev parent reply other threads:[~2015-11-05 20:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-05 18:17 [PATCH 0/2] Remove non-blocking fds from run-command Stefan Beller
2015-11-05 18:17 ` [PATCH 1/2] run-command: Remove set_nonblocking Stefan Beller
2015-11-05 18:45 ` Junio C Hamano
2015-11-05 19:22 ` Stefan Beller
2015-11-05 19:37 ` Junio C Hamano
2015-11-05 20:27 ` Johannes Sixt
2015-11-05 20:50 ` Junio C Hamano [this message]
2015-11-05 22:20 ` Stefan Beller
2015-11-06 5:51 ` Johannes Sixt
2015-11-06 19:00 ` Stefan Beller
2015-11-06 21:41 ` Johannes Sixt
2015-11-05 18:17 ` [PATCH 2/2] strbuf: Correct documentation for strbuf_read_once Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa8qs5fxi.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=ericsunshine@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=johannes.schindelin@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.