X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=run-command.h;h=debe3074b5a01fb5a19e61f07ff66c250cdc4f82;hb=6abf189506712a0e3c5ea796d136177b8f24ca22;hp=1fc781d7668468f9e74bd430b7569dc040440ba8;hpb=f124e986cf19e8f36895ae474d50f8d389e73d02;p=git.git diff --git a/run-command.h b/run-command.h index 1fc781d76..debe3074b 100644 --- a/run-command.h +++ b/run-command.h @@ -14,13 +14,29 @@ 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; const char *dir; const char *const *env; - unsigned close_in:1; - unsigned close_out:1; unsigned no_stdin:1; unsigned no_stdout:1; unsigned no_stderr:1;