X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=run-command.h;h=5203a9ebb10b14bd06862abafed0ab73d7514a3d;hb=847d10f56d7853cd0e139a7c2e6ad0ad2de5c464;hp=94e1e9d516887d818f99f8f6d6b3ded3f3be6d6f;hpb=c78a24986d4d3faff810e87dbcd0ac99f0eabbce;p=git.git diff --git a/run-command.h b/run-command.h index 94e1e9d51..5203a9ebb 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; }; @@ -59,7 +76,12 @@ struct async { int (*proc)(int fd, void *data); void *data; int out; /* caller reads from here and closes it */ +#ifndef __MINGW32__ pid_t pid; +#else + HANDLE tid; + int fd_for_proc; +#endif }; int start_async(struct async *async);