diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index 86220f66..f16aa766 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -25,10 +25,6 @@ class Pry # Pry.custom_completions = proc { Dir.entries('.') } attr_accessor :custom_completions - # Value returned by last executed Pry command. - # @return [Object] The command value - attr_accessor :cmd_ret_value - # @return [Fixnum] The current input line. attr_accessor :current_line diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index f05d3b23..4cd778dc 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -278,7 +278,7 @@ class Pry # @param [String] val The input string. # @return [Boolean] Whether the input is null. def null_input?(val) - val.empty? && !Pry.cmd_ret_value + val.empty? && !Thread.current[:__pry_cmd_ret_value__] end # Read a line of input and check for ^d, also determine prompt to use. @@ -306,10 +306,10 @@ class Pry # @param [String] eval_string The cumulative lines of input. # @param [Binding] target The target of the Pry session. def process_line(val, eval_string, target) - Pry.cmd_ret_value = @command_processor.process_commands(val, eval_string, target) + Thread.current[:__pry_cmd_ret_value__] = @command_processor.process_commands(val, eval_string, target) - if Pry.cmd_ret_value - eval_string << "Pry.cmd_ret_value\n" + if Thread.current[:__pry_cmd_ret_value__] + eval_string << "Thread.current[:__pry_cmd_ret_value__]\n" else # only commands (with no ret_value) should have an empty `val` so this ignores their result eval_string << "#{val.rstrip}\n" if !val.empty?