From: James Edward Gray II Date: 2010-06-25T23:52:39+09:00 Subject: Re: Highline giving EOFERROR, input stream exhausted On Jun 25, 2010, at 5:36 AM, R.. Kumar wrote: > I am first taking multiline input from user. User may end input using > Ctr-d. > > Then I use highline's menu and get: > /opt/local/lib/ruby1.9/gems/1.9.1/gems/highline-1.5.2/lib/highline.rb:603:in > `get_line': The input stream is exhausted. (EOFError) Interesting. Your code does work for me: $ cat multi-read.rb #!/usr/bin/env ruby -wKU require "rubygems" require "highline/import" def get_lines lines = nil $stdin.each_line do |line| line.chomp! if line =~ /^bye$/ break end if lines lines << "\n" + line else lines = line end end return lines end def _choice prompt, choices puts "got: #{prompt} ::: #{choices} " STDIN.reopen '/dev/tty' choose do |menu| menu.prompt = prompt menu.choices(choices) do |n| return n; end end end p get_lines _choice "? ", "A choice" __END__ $ ruby multi-read.rb one two three "one\ntwo\nthree" got: ? ::: A choice 1. A choice ? 1 "A choice" I used Control-D to stop the multi-line entry there. What platform are you on and what version of Ruby are you using? James Edward Gray II