Mail Archives: cygwin/2002/10/25/10:31:20
Jim,
It would be very hard to redirect stdin *to* /dev/null, as stdin is an
input stream... You could, however, redirect it *from* /dev/null.
Even though stdin is not read, some applications test whether they're
running in a tty by checking where stdin comes from. Redirecting it from
/dev/null lets the applications know that their input comes from a file
rather than a console, and they wouldn't be trying to open the console (to
set tty parameters, for example, or buffering). Some applications also
*do* try to read stdin, and continue upon encountering an EOF.
Redirecting stdin from /dev/null is a standard trick in standalone scripts
that don't take any input. It should work just fine in a cygwin shell
(sh/bash/tcsh/zsh) using the "script < /dev/null" syntax. I believe
Windows also has an input redirection operator ('<'). The best way to
check is to try it and see...
Igor
On Fri, 25 Oct 2002, Jim Rainville wrote:
> Hi Igor -
> Thanks for the response.
> I didn't redirect stdin but why would I need to? I just want to redirect
> stdout and stderr to a log file. Stdin should come from the console but
> there is no console input (unless args to applications are stdin).
> You're suggesting I redirect stdin to /dev/null? Would this work in
> windows? What would be the effect?
>
> Thanks.
> Jim
>
> -----Original Message-----
> From: Igor Pechtchanski [mailto:pechtcha AT cs DOT nyu DOT edu]
> Sent: Friday, October 25, 2002 6:21 AM
> To: Jim Rainville
> Cc: cygwin AT cygwin DOT com
> Subject: Re: console output problem
>
> On Fri, 25 Oct 2002, Jim Rainville wrote:
>
> > Hi -
> >
> > I'm trying to set up a perl build script that runs every night, builds a
> > bunch of code (using gcc) and saves the output to some log files. So I
> > redirect stdout and stderr to some files and run the script that builds
> > the load. This runs fine when I run it from the command prompt but when
> > I run it from the windows scheduler I get a bunch of errors of the form:
> >
> > 0 [main] cpp 1001 fhandler_console::de_linearize: error opening console after exec, errno 13, Win32 error 5
> > 0 [main] cc1 1002 fhandler_console::de_linearize: error opening console after exec, errno 13, Win32 error 5
> > 0 [main] as 1003 fhandler_console::de_linearize: error opening console after exec, errno 13, Win32 error 5
> > 0 [main] cpp 1001 fhandler_console::de_linearize: error opening console after exec, errno 13, Win32 error 5
> > 0 [main] cc1 1002 fhandler_console::de_linearize: error opening console after exec, errno 13, Win32 error 5
> > 0 [main] as 1003 fhandler_console::de_linearize: error opening console after exec, errno 13, Win32 error 5
> >
> > It looks like since the scheduler doesn't have a console associated with
> > it the fhandler_console throws an error even though stdout is
> > redirected. Has anybody come across this before? Any clues how to fix
> > it?
> >
> > Thanks. Jim
>
> Jim,
>
> Did you also remember redirect stdin from /dev/null?
> Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -