Skip to content

Commit

Permalink
Defuse time bomb on EditLine Readline wrapper
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
rking authored and rkingpa@sharpsaw.org committed Feb 8, 2013
1 parent b33fa0a commit b3a74e5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/pry/pry_class.rb
Expand Up @@ -247,6 +247,15 @@ def self.default_editor_for_platform
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!
Expand Down

0 comments on commit b3a74e5

Please sign in to comment.