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

Defuse time bomb on EditLine Readline wrapper

If you are using the basic OS X Readline impl, and you Pry.auto_resize!,
you'll find that their Readline.set_screen_size = ___ segfaults.

Instead of letting this happen, we'll tell the user about it and point
them to the fix (of using GNU Readline).
This commit is contained in:
☈king 2013-02-08 00:41:37 -06:00 committed by rkingpa@sharpsaw.org
parent b33fa0ab69
commit b3a74e5809

View file

@ -247,6 +247,15 @@ class Pry
end
def self.auto_resize!
ver = Readline::VERSION
if ver[/edit/i]
warn <<-EOT
Readline version #{ver} detected - will not auto_resize! correctly.
For the fix, use GNU Readline instead:
https://github.com/guard/guard/wiki/Add-proper-Readline-support-to-Ruby-on-Mac-OS-X
EOT
return
end
trap :WINCH do
begin
Readline.set_screen_size *Terminal.size!