X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Thu, 26 Nov 2009 12:04:52 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: run: requires CYGWIN=tty? Message-ID: <20091126110452.GN29173@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4B0E0338 DOT 9000202 AT users DOT sourceforge DOT net> <4B0E07AC DOT 3020505 AT cwilson DOT fastmail DOT fm> <20091126093500 DOT GA11956 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091126093500.GA11956@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Nov 26 10:35, Corinna Vinschen wrote: > However, Chuck, can you please try the below patch to run.c instead? > It makes the stdout and stderr handles already distinct in run: > > Index: src/run.c > =================================================================== > RCS file: /cvs/cygwin-apps/run/src/run.c,v > retrieving revision 1.9 > diff -u -p -r1.9 run.c > --- src/run.c 18 Aug 2009 15:51:05 -0000 1.9 > +++ src/run.c 26 Nov 2009 09:33:11 -0000 > @@ -418,7 +418,10 @@ BOOL configure_startupinfo(STARTUPINFO* > psi->hStdOutput = CreateFile( "CONOUT$", GENERIC_WRITE | GENERIC_READ, > FILE_SHARE_WRITE, &sa, > OPEN_EXISTING, 0, 0 ); > - psi->hStdError = psi->hStdOutput; > + if (!DuplicateHandle (GetCurrentProcess (), psi->hStdOutput, > + GetCurrentProcess (), &psi->hStdError, > + 0, TRUE, DUPLICATE_SAME_ACCESS)) > + psi->hStdError = psi->hStdOutput; > > Trace(("Have a console, and not requesting pipes: connecting child stdio to console")); > return TRUE; Erm... btw., I would change the sharing flags as well. I don't know how much influence they have on a console handle, but they certainly *look* wrong. You can also just simply call CreateFile for the stderr handle as well, same as for the stdout handle: Index: src/run.c =================================================================== RCS file: /cvs/cygwin-apps/run/src/run.c,v retrieving revision 1.9 diff -u -p -r1.9 run.c --- src/run.c 18 Aug 2009 15:51:05 -0000 1.9 +++ src/run.c 26 Nov 2009 11:04:20 -0000 @@ -413,12 +413,14 @@ BOOL configure_startupinfo(STARTUPINFO* *bUsingPipes = FALSE; psi->hStdInput = CreateFile( "CONIN$", GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_READ, &sa, + FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, OPEN_EXISTING, 0, 0 ); psi->hStdOutput = CreateFile( "CONOUT$", GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_WRITE, &sa, + FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, + OPEN_EXISTING, 0, 0 ); + psi->hStdError = CreateFile( "CONOUT$", GENERIC_WRITE | GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, OPEN_EXISTING, 0, 0 ); - psi->hStdError = psi->hStdOutput; Trace(("Have a console, and not requesting pipes: connecting child stdio to console")); return TRUE; -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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