From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Sixt <j6t@kdbg.org>,
Karsten Blees <blees@dcon.de>, Stepan Kasal <kasal@ucw.cz>,
Jeff King <peff@peff.net>, Lukas Fleischer <lfleischer@lfos.de>
Subject: Re: [PATCH] Remove obsolete comment from color.h
Date: Tue, 28 Jun 2016 18:24:05 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1606281822240.12947@virtualbox> (raw)
In-Reply-To: <xmqqinwt9v6e.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Tue, 28 Jun 2016, Junio C Hamano wrote:
> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>
> > Originally, ANSI color sequences were supported on Windows only by
> > overriding the printf() and fprintf() functions, as mentioned in e7821d7
> > (Add a notice that only certain functions can print color escape codes,
> > 2009-11-27).
> >
> > As of eac14f8 (Win32: Thread-safe windows console output, 2012-01-14),
> > however, this is no longer the case, as the ANSI color sequence support
> > code needed to be replaced with a thread-safe version, one side effect
> > being that stdout and stderr handled no matter which function is used to
> > write to it.
>
> So as long as we write via stdio to stdout/stderr, you can show
> colors? Or is it now stronger, in that as long as we do anything
> that ends up writing to file descriptors 1 or 2, you can show
> colors?
It means that we override stdout/stderr with a pipe that is parsed for the
color sequences. If stdout or stderr are reopened later, this color
handling will not apply to the new file descriptor/stream.
Essentially, the caveat in color.h that one should use fprintf() and
printf() when outputting color sequences to a terminal no longer holds
true. fwrite() or write() work just as well.
Ciao,
Dscho
next prev parent reply other threads:[~2016-06-28 16:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-28 10:02 [PATCH] Remove obsolete comment from color.h Johannes Schindelin
2016-06-28 15:42 ` Junio C Hamano
2016-06-28 16:24 ` Johannes Schindelin [this message]
2016-06-28 16:36 ` Junio C Hamano
2016-06-28 16:45 ` Jeff King
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=alpine.DEB.2.20.1606281822240.12947@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=blees@dcon.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=kasal@ucw.cz \
--cc=lfleischer@lfos.de \
--cc=peff@peff.net \
/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).