From: Anders Melchiorsen Date: Mon, 04 Aug 2008 00:30:03 GMT Subject: [PATCH] Flush output in start_async Message-ID: <1217809803-23391-1-git-send-email-mail@cup.kalibalik.dk> In-Reply-To: <7vej557hlq.fsf@gitster.siamese.dyndns.org> This prevents double output in case stdout is redirected. Signed-off-by: Anders Melchiorsen --- run-command.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/run-command.c b/run-command.c index a3b28a6..6af83c5 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)); -- 1.5.6.4