X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4B0E07AC.3020505@cwilson.fastmail.fm> Date: Wed, 25 Nov 2009 23:44:28 -0500 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: run: requires CYGWIN=tty? References: <4B0E0338 DOT 9000202 AT users DOT sourceforge DOT net> In-Reply-To: <4B0E0338.9000202@users.sourceforge.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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, DUPLICATE_SAME_ACCESS)) { /* 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. -- Chuck -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple