X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=run-command.h;h=debe3074b5a01fb5a19e61f07ff66c250cdc4f82;hb=6abf189506712a0e3c5ea796d136177b8f24ca22;hp=94e1e9d516887d818f99f8f6d6b3ded3f3be6d6f;hpb=3e4bb087a18435b12eb82116e93af2887578e816;p=git.git diff --git a/run-command.h b/run-command.h index 94e1e9d51..debe3074b 100644 --- a/run-command.h +++ b/run-command.h @@ -14,15 +14,32 @@ 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; unsigned git_cmd:1; /* if this is to be git sub-command */ unsigned stdout_to_stderr:1; };