delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/16/11:32:06

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 <cgf-use-the-mailinglist-please AT cygwin DOT com>
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
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
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=<file> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019