# File lib/pry/pry_instance.rb, line 402 def process_command(val) val = val.chomp result = commands.process_line(val, :target => current_binding, :output => output, :eval_string => @eval_string, :pry_instance => self ) # set a temporary (just so we can inject the value we want into eval_string) Pry.current[:pry_cmd_result] = result # note that `result` wraps the result of command processing; if a # command was matched and invoked then `result.command?` returns true, # otherwise it returns false. if result.command? if !result.void_command? # the command that was invoked was non-void (had a return value) and so we make # the value of the current expression equal to the return value # of the command. @eval_string.replace "::Pry.current[:pry_cmd_result].retval\n" end true else false end end