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>
Anders Melchiorsen committed
Aug 4, 2008 at 02:30 UTC
2c3766f06adf0ba226a592939971f8ef587e54c1
2 files changed
+9
run-command.c
+3
@@ -304,6 +304,9 @@ int start_async(struct async *async)
304
async->out = pipe_out[0];
305
306
#ifndef __MINGW32__
307
+ /* Flush stdio before fork() to avoid cloning buffers */
308
+ fflush(NULL);
309
+
310
async->pid = fork();
311
if (async->pid < 0) {
312
error("fork (async) failed: %s", strerror(errno));
t/t5601-clone.sh
+6
@@ -31,6 +31,12 @@ test_expect_success 'clone with excess parameters (2)' '
31
32
'
33
34
+test_expect_success 'output from clone' '
35
+ rm -fr dst &&
36
+ git clone -n "file://$(pwd)/src" dst >output &&
37
+ test $(grep Initialized output | wc -l) = 1
38
+'
39
+
40
test_expect_success 'clone does not keep pack' '
41
42
rm -fr dst &&