From: ara.t.howard@... Date: 2006-09-28T06:50:03+09:00 Subject: Re: how to determine if pipe is given On Thu, 28 Sep 2006 gwtmp01@mac.com wrote: > If your program is prepared to deal with piped input, why are you concerned > about input coming from the keyboard? If I found a program that worked as: > > cat file | program > > and as > > program < file > > but did not work as just > > program it may well work, but hang forever in cron though: this is as easy to do as infile = get_infile # oops, returned nil system "program #{ infile }" # hangs forever that's also very problematic for prorgams which take two arguments: cat infile | program - outfile cat infile | program - - | outfile_filter > outfile note that you cannot simply say that the abscence of infile means stdin and similar for outfile because program infile_or_outfile? i'm sure one could skin this differently, i just have debugged many hung processes that make assumptions based on STDIN.tty? kind regards. -a -- in order to be effective truth must penetrate like an arrow - and that is likely to hurt. -- wei wu wei