Re: [PATCH v3 3/3] mingw: replace isatty() hack
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 18, 2017, 12:13 UTC
- Message-ID
- <alpine.DEB.2.20.1701181304490.3469@virtualbox>
- In-Reply-To
- <2ce6060b891f8313cc63a95a9cba9064b7f82eb8.1482448531.git.johannes.schindelin@gmx.de>
Hi,
On Fri, 23 Dec 2016, Johannes Schindelin wrote:
Show 18 quoted lines
> + /*
> + * Use stock dup2() to re-bind fd to the new handle. Note that
> + * this will implicitly close(1) and close both fd=1 and the
> + * originally associated handle. It will open a new fd=1 and
> + * call DuplicateHandle() on the handle associated with new_fd.
> + * It is because of this implicit close() that we created the
> + * copy of the original.
> + *
> + * Note that we need to update the cached console handle to the
> + * duplicated one because the dup2() call will implicitly close
> + * the original one.
> + *
> + * Note that dup2() when given target := {0,1,2} will also
> + * call SetStdHandle(), so we don't need to worry about that.
> + */
> + if (console == handle)
> + console = duplicate;
> + dup2(new_fd, fd);Sadly, v2 was applied to `maint` instead of this revision, so Hannes' suggestions that I addressed in v3 were dropped silently.
I will send out a follow-up patch in a moment.
Ciao, Johannes