From: Daniel Finnie Date: 2008-04-19T02:08:11+09:00 Subject: Re: What's the 'portable' way to do this? Hi, I think ARGF might work for your needs: data = ARGF.read Give it a try, Dan On 4/17/08, Xie Hanjian wrote: > Hi, > > I want to know if there's a more 'portable' way to do this in ruby: > > I hope my programe will accept data from redirected stdin or pipe, like > > cat bar | foo.rb > foo.rb < bar > > And after read the data I want to interact with the foo.rb in console. > The problem is stdin has been redirected so I have to: > > STDIN.reopen('/dev/tty') > > Hardcoding a string in the script seems not good. Any suggestions? > > Thanks > Jan > > > -- > jan=callcc{|jan|jan};jan.call(jan) > >