1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Dont' infinite loop on errors in readline.

Instead try to show a useful error message.
This commit is contained in:
Conrad Irwin 2012-03-24 12:32:28 -07:00
parent e94d17370d
commit afe900721b

View file

@ -522,6 +522,16 @@ class Pry
self.input = input_stack.pop
end
retry
# We want to catch exceptions that happen in readline and abort completely,
# otherwise we'll likely go round and round the repl-loop and fail every time.
rescue RescuableException => e
puts "Error: #{e.message}"
puts "FATAL: Pry failed to get user input using `#{input.inspect}`."
puts "To fix this you may be able to pass input and output file descriptors to pry directly. e.g."
puts " Pry.config.input = STDIN"
puts " Pry.config.output = STDOUT"
puts " binding.pry
throw(:breakout)
end
end
private :handle_read_errors