When I ran the ruby code below, pressing ctrl + c would immediately stop
the program

  trap("INT") { exit }
  while line = gets; puts line; end


However, when I use system() command before the gets, pressing ctrl + c
would not take any effect unless I hit "Enter". It seems like it has to
do with system() forking a child process and somehow the parent could no
longer detect SIGINT. How would you change the code so that ctrl + c
would take immediate effect for the code below

  trap("INT") { exit }

  if system("which ruby > /dev/null")
    puts "ruby is installed"
  end

  while line = gets; puts line; end

-- 
Posted via http://www.ruby-forum.com/.