T
Tudor Lupei
Considering a trivial example:
trap :INT do
puts
puts 'Bye'
exit
end
# system 'date'
print 'Say something: '
STDOUT.flush
puts "You said: #{STDIN.gets}"
When prompted to say something, hitting Ctrl+C will call trapINT)
block.
However, after uncommenting line 7, Ctrl+C won't cause a call to
trapINT) block unless I send a newline or EOF.
Can anyone shed some light on this one?
Platform: linux; ruby 1.8.7
Thanks
trap :INT do
puts
puts 'Bye'
exit
end
# system 'date'
print 'Say something: '
STDOUT.flush
puts "You said: #{STDIN.gets}"
When prompted to say something, hitting Ctrl+C will call trapINT)
block.
However, after uncommenting line 7, Ctrl+C won't cause a call to
trapINT) block unless I send a newline or EOF.
Can anyone shed some light on this one?
Platform: linux; ruby 1.8.7
Thanks