stderr issues when running bat scripts

Clint Bennion cd_bennion@yahoo.com
Thu Jan 29 18:08:00 GMT 2004


I have downloaded the latest snapshot and the issue remains.  Also attached is the cygcheck -srv
output.
Clint

--- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
> On Wed, 28 Jan 2004, Clint Bennion wrote:
> 
> > Although this appears on the surface to be a windows issue I am bringing
> > this to the cygwin group for two reasons.
> > 1 - It only fails when I run it from a bash shell.
> > 2 - It recently started failing.  I re-installed an older version of the
> > cygwin package and the problem goes away.
> >
> > Version that failed:
> > Cygwin 1.5.6-1
> >
> > Tested working version:
> > Cygwin 1.5.5-1
> >
> > OS
> > Windows 2000 Professional
> > 5.0.2195 Service Pack 4 Build 2195
> 
> There's more to your Cygwin configuration than the version of the DLL.
> Please read and follow <http://cygwin.com/problems.html>.  Attaching the
> output of "cygcheck -svr" is not optional.
> 
> > Here are two scripts for a test case.  The bat script calls the cscript in a for loop.  The
> for
> > loop catches the last line from stdout and puts it in the variable out.  The cscript simply
> puts
> > the text "STDOUT" to stdout and "STDERR" to stderr.
> >
> > ======Start tst.bat
> > rem echo "" 1>&2
> > echo "********************************"
> > set CMD=cscript /nologo tst.wsf
> > FOR /F "delims=#" %%A IN ('%CMD%') DO set OUT=%%A
> > echo %OUT%
> > ======End tst.bat
> > ======Start tst.wsf
> > <package>
> >         <job id="test">
> >                 <script language="JScript">
> >                         WScript.stderr.writeLine( "STDERR" );
> >                         WScript.stdout.writeLine( "STDOUT" );
> >                 </script>
> >         </job>
> > </package>
> > ======End tst.wsf
> >
> > ======Start output
> > m:\class\cmd>rem echo "" 1>&2
> >
> > m:\class\cmd>echo "********************************"
> > "********************************"
> >
> > m:\class\cmd>set CMD=cscript /nologo tst.wsf
> >
> > m:\class\cmd>FOR /F "delims=#" %A IN ('cscript /nologo tst.wsf') DO set OUT=%A
> >
> > m:\class\cmd>set OUT=CScript Error: Execution of the Windows Script Host failed.
> >  (Unspecified error
> >
> > m:\class\cmd>set OUT=)
> >
> > m:\class\cmd>echo )
> > =========End Output
> >
> > There are multiple things that I can do to get the scripts to run.
> > 1) Uncomment the first echo line.  This line redirects a return to stderr.
> > 2) Don't ever send to stderr in the cscript
> > 3) Redirect either stdout or stderr to a file when running tst.bat
> >
> > Another interesting test case that I will describe.  Adding a line with
> > "%CMD%" before and after the for loop causes the cscript to be called
> > directly.  In this case the first call succeeds.  The for loop fails and
> > the next call to cscript fails.
> >
> > I probably shouldn't do this, since I know so little about the inner
> > workings, but here is my musings. It would seem that the for loop causes
> > special problems.  Possibly because it is doing a form of redirection,
> > stdout to the set commands and stderr should go to the screen.
> > Although this causes problems for future calls to cscript I don't know
> > why.  It must be that adding the echo to stderr at the first causes the
> > plumbing for stderr to be setup properly and all future commands
> > succeed.  There is no need to respond to this paragraph.  I wrote it
> > just to help get the thought process going if it is needed.
> >
> > Clint
> 
> Did you try the latest snapshot?  There were some problems with 1.5.6 that
> were fixed in CVS.  See <http://cygwin.com/snapshots/>.
> 	Igor
> -- 
> 				http://cs.nyu.edu/~pechtcha/
>       |\      _,,,---,,_		pechtcha@cs.nyu.edu
> ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
>      |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
>     '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
> 
> "I have since come to realize that being between your mentor and his route
> to the bathroom is a major career booster."  -- Patrick Naughton
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040129/861a1fb9/attachment.txt>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list