From: Bauduin Raphael Date: 2004-12-29T05:56:47+09:00 Subject: optparse and gets Hi, I'm using optparse. At a certain point in the program, I need a confirmation (exept if --no-confirm is used as argument). Here's a program illustrating my question: #!/usr/bin/env ruby require 'optparse' opts = OptionParser.new opts.on("--no-confirm" ) { |val| confirm=false } puts "enter string:" s = gets puts "you entered #{s}" when calling this script without any argument, it runs fine. But once I pass it the --no-confirm argument, if fails with this message: ../test.rb:9:in `gets': No such file or directory - --no-confirm (Errno::ENOENT) from ./test.rb:9 I have fixed the problem by calling $stdin.gets instead. But I don't see what caused the problem in the first place, and I'm curious enough to send a message here ;-) thanks for any indication. Raph