From 0938a55f9a3c06c5ec1b092adc894361f170cb1b Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Sat, 11 Feb 2012 11:00:51 +0100 Subject: [PATCH] Fix for irb crash during completion For some Ruby implementations Readline.point is missing. This causes irb to crash under Ruby Enterprise Edition 2011.12 for any irb completion that is attempted. This change at least avoids the crash though the original function (opening the text editor) cannot be executed anymore. --- lib/pry-editline.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pry-editline.rb b/lib/pry-editline.rb index 38b2f80..5c3625f 100644 --- a/lib/pry-editline.rb +++ b/lib/pry-editline.rb @@ -48,7 +48,9 @@ def self.hijack_inputrc def self.completion_proc lambda do |s| - if Readline.point == 0 && Readline.line_buffer =~ / $/ + if Readline.respond_to?(:point) && Readline.respond_to?(:line_buffer) && + Readline.point == 0 && Readline.line_buffer =~ / $/ + then require 'tempfile' Tempfile.open(['readline-','.rb']) do |f| f.puts(Readline.line_buffer[0..-3])