path: root/run-command.h
diff options
authorErik Faye-Lund <>2010-02-05 20:57:38 (GMT)
committerJunio C Hamano <>2010-02-06 04:57:22 (GMT)
commitae6a5609c025d9ac79e54a3a052704e25d885314 (patch)
treec74d50beebc5c7bfe2f5ca9e335c45c534243af7 /run-command.h
parent4f41b611481bad08319966f7787fc7c4c7bfaa52 (diff)
run-command: support custom fd-set in async
This patch adds the possibility to supply a set of non-0 file descriptors for async process communication instead of the default-created pipe. Additionally, we now support bi-directional communiction with the async procedure, by giving the async function both read and write file descriptors. To retain compatiblity and similar "API feel" with start_command, we require start_async callers to set .out = -1 to get a readable file descriptor. If either of .in or .out is 0, we supply no file descriptor to the async process. [sp: Note: Erik started this patch, and a huge bulk of it is his work. All bugs were introduced later by Shawn.] Signed-off-by: Erik Faye-Lund <> Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'run-command.h')
1 files changed, 6 insertions, 3 deletions
diff --git a/run-command.h b/run-command.h
index a29171a..65ccb1c 100644
--- a/run-command.h
+++ b/run-command.h
@@ -64,17 +64,20 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
struct async {
- * proc writes to fd and closes it;
+ * proc reads from in; closes it before return
+ * proc writes to out; closes it before return
* returns 0 on success, non-zero on failure
- int (*proc)(int fd, void *data);
+ int (*proc)(int in, int out, void *data);
void *data;
+ int in; /* caller writes here and closes it */
int out; /* caller reads from here and closes it */
#ifndef WIN32
pid_t pid;
- int fd_for_proc;
+ int proc_in;
+ int proc_out;