diff options
author | Jeff King <peff@peff.net> | 2016-06-17 19:38:47 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-17 17:03:56 -0700 |
commit | 96335bcf4d64c29add3692fb41671190123cf44e (patch) | |
tree | 079533fb3d349577395d95f0047e13a73f9b70a4 /prio-queue.c | |
parent | verify_signed_buffer: use tempfile object (diff) | |
download | tgif-96335bcf4d64c29add3692fb41671190123cf44e.tar.xz |
run-command: add pipe_command helper
We already have capture_command(), which captures the stdout
of a command in a way that avoids deadlocks. But sometimes
we need to do more I/O, like capturing stderr as well, or
sending data to stdin. It's easy to write code that
deadlocks racily in these situations depending on how fast
the command reads its input, or in which order it writes its
output.
Let's give callers an easy interface for doing this the
right way, similar to what capture_command() did for the
simple case.
The whole thing is backed by a generic poll() loop that can
feed an arbitrary number of buffers to descriptors, and fill
an arbitrary number of strbufs from other descriptors. This
seems like overkill, but the resulting code is actually a
bit cleaner than just handling the three descriptors
(because the output code for stdout/stderr is effectively
duplicated, so being able to loop is a benefit).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'prio-queue.c')
0 files changed, 0 insertions, 0 deletions