git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Anders Melchiorsen <mail@cup.kalibalik.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>, git@vger.kernel.org
Subject: Re: [PATCH] Use line buffering for standard output
Date: Sun, 03 Aug 2008 17:24:01 -0700	[thread overview]
Message-ID: <7vej557hlq.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <87hca1ogto.fsf@cup.kalibalik.dk> (Anders Melchiorsen's message of "Mon, 04 Aug 2008 00:48:51 +0200")

Anders Melchiorsen <mail@cup.kalibalik.dk> writes:

> From: Anders Melchiorsen <mail@cup.kalibalik.dk>
> Date: Mon, 4 Aug 2008 00:35:40 +0200
> Subject: [PATCH] Flush standard output in start_async
>
> This prevents double output in case stdout is redirected.
>
> Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
> ---
>  run-command.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/run-command.c b/run-command.c
> index a3b28a6..67be079 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 output before fork() to avoid cloning the buffer */
> +	fflush(stdout);
> +
>  	async->pid = fork();
>  	if (async->pid < 0) {
>  		error("fork (async) failed: %s", strerror(errno));

I think this with s/stdout/NULL/ would be a reasonable thing to do.

  reply	other threads:[~2008-08-04  0:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-03 21:26 [PATCH] Use line buffering for standard output Anders Melchiorsen
2008-08-03 21:38 ` Junio C Hamano
2008-08-03 21:46 ` Linus Torvalds
2008-08-03 22:48   ` Anders Melchiorsen
2008-08-04  0:24     ` Junio C Hamano [this message]
2008-08-04  0:30       ` [PATCH] Flush output in start_async Anders Melchiorsen
2008-08-04  5:50       ` [PATCH] Use line buffering for standard output Linus Torvalds
2008-08-04 10:18         ` [PATCH] Add output flushing before fork() Anders Melchiorsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vej557hlq.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mail@cup.kalibalik.dk \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).