Re: [PATCH 4/7] run-command: add pipe_command helper

2016-06-17 Thread Eric Sunshine
On Fri, Jun 17, 2016 at 7:28 PM, Jeff King wrote: > On Fri, Jun 17, 2016 at 04:03:18PM -0400, Eric Sunshine wrote: >> > diff --git a/run-command.h b/run-command.h >> > @@ -79,17 +79,34 @@ int run_command_v_opt(const char **argv, int opt); >> > /** >> > - * Execute the given command, capturing its

Re: [PATCH 4/7] run-command: add pipe_command helper

2016-06-17 Thread Jeff King
On Fri, Jun 17, 2016 at 04:03:18PM -0400, Eric Sunshine wrote: > > diff --git a/run-command.h b/run-command.h > > @@ -79,17 +79,34 @@ int run_command_v_opt(const char **argv, int opt); > > /** > > - * Execute the given command, capturing its stdout in the given strbuf. > > + * Execute the given c

Re: [PATCH 4/7] run-command: add pipe_command helper

2016-06-17 Thread Eric Sunshine
On Thu, Jun 16, 2016 at 5:37 AM, Jeff King wrote: > 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 > deadlock

[PATCH 4/7] run-command: add pipe_command helper

2016-06-16 Thread Jeff King
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 comman