Why does the gets call get my command-line text?
D:\temp>type test.rb
puts gets
D:\temp>test.rb hey
D:\temp\test.rb:1:in `gets’: No such file or directory - “hey”
(Errno::ENOENT)
from D:\temp\test.rb:1
D:\temp>ruby -e 'puts VERSION, PLATFORM’
1.6.6
i586-mswin32
Chris
http://clabs.org
Why does the gets call get my command-line text?
Whoops - sorry to post before researching. According to this:
http://ruby-talk.org/blade/37535
that’s just the way it is. To make sure this doesn’t happen, I need to
change my gets call to:
$stdin.gets
Chris
http://clabs.org
ts1
(ts)
3
Why does the gets call get my command-line text?
Kernel#gets is trying to read from the file given in ARGV, or from $stdin
if no files are given
Guy Decoux