X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Message-ID: <32620821.post@talk.nabble.com> Date: Sun, 9 Oct 2011 13:10:15 -0700 (PDT) From: "jan.kolar" To: cygwin AT cygwin DOT com Subject: Re: Problem redirecting stderr to pipe in subprocess In-Reply-To: <4E906DD1.50107@cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <4E906DD1 DOT 50107 AT cornell DOT edu> X-IsSubscribed: yes 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 Ken Brown-6 wrote: > > The attached STC arose from my attempt to understand the problem > discussed starting in > > http://cygwin.com/ml/cygwin/2011-09/msg00405.html . > > I'm starting a new thread because there appears to be a Cygwin problem > having nothing to do with emacs. > > The STC creates a pipe and then runs `bash -ic ls' in a subprocess, with > both stdout and stderr sent to the pipe. The parent process reads from > the pipe and echoes it to the terminal. > > On Linux, I first get the error messages (presumably expected) > > bash: cannot set terminal process group (-1): Invalid argument > bash: no job control in this shell > > followed by the directory listing. On Cygwin, the bash process produces > no output but is simply stopped, and I have to kill it from another > terminal before the main program will exit. This happens both with > cygwin-1.7.9 and the latest snapshot. Here are a few comments: > > 1. The problem disappears if I don't send bash's stderr to the pipe. > > 2. The problem also disappears if I replace -ic by -c in the call to > bash, presumably because there's nothing sent to stderr in that case. > > 3. The problem disappears if I don't use a pipe but just have the bash > subprocess write to the terminal, even if I redirect bash's stderr to > stdout. > > Ken > * Does your program work when compiled by gcc-4 (as opposed to gcc-3) ? -- Because I also spot some problem with it, if gcc-3 is used: # correct with gcc-4 $ gcc-4 STC.c && ./a.exe ls: cannot access neeeee: No such file or directory .bashrc* # custom cygwin1.dll warning with gcc-3 : $ gcc-3 STC.c && ./a.exe ##### Ooops, first in forkee and it is not dll:init; where=dcrt0.cc dll_crt0_1() pozde - je po linked dll::init iwhere=90 ls: cannot access neeeee: No such file or directory .bashrc* I think I've have never seen the message (its my debug message); if you confirm your program makes difference between gcc-3 and gcc-4, I will have find out what it means. (Probably it is like unexpected ordering of DLL's or ordering of their initialization.) JK -- View this message in context: http://old.nabble.com/Problem-redirecting-stderr-to-pipe-in-subprocess-tp32616089p32620821.html Sent from the Cygwin list mailing list archive at Nabble.com. -- 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