This is the mail archive of the
mailing list for the Cygwin project.
Re: run: requires CYGWIN=tty?
- From: Charles Wilson <cygwin at cwilson dot fastmail dot fm>
- To: cygwin at cygwin dot com
- Date: Wed, 25 Nov 2009 23:44:28 -0500
- Subject: Re: run: requires CYGWIN=tty?
- References: <4B0E0338.firstname.lastname@example.org>
Yaakov (Cygwin/X) wrote:
> I came across this error with run when launched from the cmd prompt with
> an empty CYGWIN variable:
> 1 [main] xterm 1248 dtable::stdio_init: couldn't make stderr
> distinct from stdout
> If I set CYGWIN=tty then this does not occur. Is this expected?
Not by me. The relevant code in cygwin looks like this:
/* STD_ERROR_HANDLE has been observed to be the same as
STD_OUTPUT_HANDLE. We need separate handles (e.g. using pipes
to pass data from child to parent). */
/* CV 2008-10-17: Under debugger control, std fd's have been potentially
initialized in dtable::get_debugger_info (). In this case
init_std_file_from_handle is a no-op, so, even if out == err we don't
want to duplicate the handle since it will be unused. */
if (out == err && (!being_debugged () || !not_open (2)))
/* Since this code is not invoked for forked tasks, we don't have
to worry about the close-on-exec flag here. */
if (!DuplicateHandle (hMainProc, out, hMainProc, &err, 0, true,
/* If that fails, do this as a fall back. */
err = out;
system_printf ("couldn't make stderr distinct from stdout");
So, uhm...DuplicateHandle failed? That seems...strange. Unless the
handle being duplicated is itself invalid. (e.g. both out and err are
== INVALID_HANDLE (but then, !not_open(2) should catch that!)
Maybe somebody else will have an A-HA! moment, but without actually
debugging it this one has me confused.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple