Subject: bug#12908: 24.3.50; file `emacs_backtrace.txt'?

From: Paul Eggert <[email-masked]>
Date: Sat, 17 Nov 2012 21:19:36 -0800

On 11/17/2012 08:04 PM, Eli Zaretskii wrote:
> The
> problem is in detecting when stderr is closed or an invalid handle to
> begin with, and do the redirection only then.  In all my readings and
> tests, I was unable to find a reliable, let alone documented, way of
> determining that.

The method I gave in <http://bugs.gnu.org/12908#73>
is portable to GNU and POSIXish hosts, where you can test whether
a file descriptor FD is valid by invoking dup2 (FD, FD).
Gnulib has a dup2 implementation that works on Microsoft Windows,
so if we use that, it seems we should be able to use the same idea
there too.