X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=run-command.h;h=debe3074b5a01fb5a19e61f07ff66c250cdc4f82;hb=319a36a5c2da8dd07993caac43b7820bff3b0d37;hp=e9c84d03639a59178e16361ee70df95835b9beb3;hpb=e72ae28895b22052b7ca2eef36c039ac62671f7d;p=git.git diff --git a/run-command.h b/run-command.h index e9c84d036..debe3074b 100644 --- a/run-command.h +++ b/run-command.h @@ -14,6 +14,24 @@ enum { struct child_process { const char **argv; pid_t pid; + /* + * Using .in, .out, .err: + * - Specify 0 for no redirections (child inherits stdin, stdout, + * stderr from parent). + * - Specify -1 to have a pipe allocated as follows: + * .in: returns the writable pipe end; parent writes to it, + * the readable pipe end becomes child's stdin + * .out, .err: returns the readable pipe end; parent reads from + * it, the writable pipe end becomes child's stdout/stderr + * The caller of start_command() must close the returned FDs + * after it has completed reading from/writing to it! + * - Specify > 0 to set a channel to a particular FD as follows: + * .in: a readable FD, becomes child's stdin + * .out: a writable FD, becomes child's stdout/stderr + * .err > 0 not supported + * The specified FD is closed by start_command(), even in case + * of errors! + */ int in; int out; int err;