summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorAnders Melchiorsen <mail@cup.kalibalik.dk>2008-08-04 02:30:03 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-03 17:55:40 -0700
commit2c3766f06adf0ba226a592939971f8ef587e54c1 (patch)
tree4a381796e1d81fdaf052e1213232412c6692aae3 /run-command.c
parent22537765f51de92115592ac0a15981b8d27ef908 (diff)
downloadgit-2c3766f06adf0ba226a592939971f8ef587e54c1.tar.gz
Flush output in start_async
This prevents double output in case stdout is redirected. Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c
index a3b28a64dc..6af83c526e 100644
--- a/run-command.c
+++ b/run-command.c
@@ -304,6 +304,9 @@ int start_async(struct async *async)
async->out = pipe_out[0];
#ifndef __MINGW32__
+ /* Flush stdio before fork() to avoid cloning buffers */
+ fflush(NULL);
+
async->pid = fork();
if (async->pid < 0) {
error("fork (async) failed: %s", strerror(errno));