From 2c3766f06adf0ba226a592939971f8ef587e54c1 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Mon, 4 Aug 2008 02:30:03 +0200 Subject: Flush output in start_async This prevents double output in case stdout is redirected. Signed-off-by: Anders Melchiorsen Signed-off-by: Junio C Hamano --- run-command.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'run-command.c') 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)); -- cgit v1.2.3