Browse Source

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>
maint
Anders Melchiorsen 17 years ago committed by Junio C Hamano
parent
commit
2c3766f06a
  1. 3
      run-command.c
  2. 6
      t/t5601-clone.sh

3
run-command.c

@ -304,6 +304,9 @@ int start_async(struct async *async) @@ -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));

6
t/t5601-clone.sh

@ -31,6 +31,12 @@ test_expect_success 'clone with excess parameters (2)' ' @@ -31,6 +31,12 @@ test_expect_success 'clone with excess parameters (2)' '

'

test_expect_success 'output from clone' '
rm -fr dst &&
git clone -n "file://$(pwd)/src" dst >output &&
test $(grep Initialized output | wc -l) = 1
'

test_expect_success 'clone does not keep pack' '

rm -fr dst &&

Loading…
Cancel
Save