X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 16 Nov 2009 11:30:47 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: How to capture stderr of dos process running in bash shell?? Message-ID: <20091116163046.GC20652@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <26341304 DOT post AT talk DOT nabble DOT com> <4AFE14EB DOT 5020305 AT gmail DOT com> <20091114185556 DOT GA15089 AT ednor DOT casa DOT cgf DOT cx> <4AFF05F3 DOT 5060706 AT gmail DOT com> <26354920 DOT post AT talk DOT nabble DOT com> <4B00A0EE DOT 7070101 AT gmail DOT com> <26366227 DOT post AT talk DOT nabble DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26366227.post@talk.nabble.com> 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 Sun, Nov 15, 2009 at 06:59:03PM -0800, aputerguy wrote: > >Dave Korn writes... >> So, it just doesn't work, and that's using all MS software; it's not >> going >> to work any better in bash. I think you're probably out of luck here; I >> don't >> know any way to capture direct console output like that (short of some >> sort of >> screen scraper or even if you want a wooden table solution taking a >> snapshot >> and OCRing it...!) > >True... just for the record, you can capture stderr to a file using the flag >/errorlog= or even dump it to /dev/null using /errorlog=$(cygpath -w >/dev/null) or equivalently /errorflag=\\.\NULL which to my surprise actually >worked. And once you have split off stderr, you are left with just the >output on stdout which is now in the bash world so you can treat it using >standard bash pipes and redirection. > >I just couldn't figure out how to pipe the stderr -- since in my case I >wanted to pipe it through gzip before capturing it to a file. So, instead I >do the slightly less elegant thing of first capturing to a file and then >running gzip later on that file. > >I do agree with you though that the original question is probably more a >question of a broken windows program and I'm thinking that the help is just >plain wrong in saying that the error is on stderr but rather I believe that >stdout and stderr are a single stream unless you use /errorlog to explicitly >fork it off to a file. Ok, then since we've confirmed that this problem has nothing to do with Cygwin, I think it's time to close down this thread. cgf -- 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