Hi,
On Fri, 23 Dec 2016, Johannes Schindelin wrote:
> + /*
> + * 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