This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to capture stderr of dos process running in bash shell??


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.

-- 
View this message in context: http://old.nabble.com/How-to-capture-stderr-of-dos-process-running-in-bash-shell---tp26341304p26366227.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]