------ art_45776_29638069.1159419807340 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9/28/06, greg <eegreg / gmail.com> wrote: > > I wanted the ability to optionally pipe a file, but the program would > not require a file to be piped or given as an argument. I guess the > answer is that this cannot be done. I am afraid so, I do not know any program that reads from STDIN that will not block if there is none, Ara's idea is how it is done in Unix, I do not know why he got so much critisized for it :( I can only allow an optional file > argument, not a pipe. > > > Hmm Greg what I came up with on my Ubuntu and I will happily test it on Windows and Sarge (really should behave like my old Ubunto) is not elegant but might work for you You have a pipe for sure if ! STDIN.tty? && ENV["TERM"] but now your script will not read from STDIN in cron, but it will not block, this is a hary thing, test it carefully please as it still might block in various situations and again you only can read from STDIN in case you are attached to a terminal!! HTH anyway Robert -- Deux choses sont infinies : l'univers et la bóŐise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------ art_45776_29638069.1159419807340--