From: Robert Dober Date: 2006-09-28T21:26:36+09:00 Subject: Re: how to determine if pipe is given ------=_Part_50205_13526844.1159446392533 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9/28/06, ara.t.howard@noaa.gov wrote: > > > > i just use '-', or simply always read from STDIN, and then sleep at night > ;-) which is a very wise decision :)), nevertheless if Greg dies for it, with some performance loss one could do the following, I 'll give pseudo code = I am bad in Thread programming =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D begin timeout(3) do STDIN.eof? end rescue TimeoutError Do something without STDIN Good bye end Do something with STDIN =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Now this is far from perfect but should catch about 99.9% of the use cases. Anything I missed? YUP the treatment might BTW Greg, what do you want to do without a pipe, tell the loser that he forgot to put one ;) Cheers Robert > -a > -- > in order to be effective truth must penetrate like an arrow - and that is > likely to hurt. -- wei wu wei > > Ouch --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_50205_13526844.1159446392533--