On Sep 27, 2006, at 5:50 PM, ara.t.howard / noaa.gov wrote:

>
> it may well work, but hang forever in cron though:


Hmm. Doesn't cron arrange for stdin and stdout to be /dev/null, in  
which case
the read will simply return EOF, correct?

I just tried some experiments on Mac OS X and it seems that cron  
arranges for
stdin to be an empty pipe for cron jobs.

In any case, clearly the program has been invoked incorrectly for that
context (background cron job) and it pretty much doesn't matter what  
structure
you choose for the command line arguments it is always possible to  
screw it
up and provide the wrong arguments or plumb the wrong input or output  
sources.

> i'm sure one could skin this differently, i just have debugged many  
> hung
> processes that make assumptions based on STDIN.tty?

I'm not sure I understand.  The OP was suggesting that the program  
was designed
to read from a pipe, so it really shouldn't care if it was reading  
from a tty
device, should it?

I think of this like duck typing in Ruby.  As long as you can read lines
from the file descriptor and your program is designed to read lines  
of text,
should you really care if stdin is associated with a file, a pipe, a  
network
connection, or a tty device?  Why not just read and process the data?


Gary Wright