class Pry::REPLFileLoader

def non_interactive_mode(pry_instance, content)

Parameters:
  • pry_instance (Pry) -- the Pry instance to make non-interactive.
def non_interactive_mode(pry_instance, content)
  pry_instance.print = proc {}
  pry_instance.exception_handler = proc do |o, _e, p|
    p.run_command "cat --ex"
    o.puts "...exception encountered, going interactive!"
    interactive_mode(pry_instance)
  end
  content.lines.each do |line|
    break unless pry_instance.eval line, generated: true
  end
  return if pry_instance.eval_string.empty?
  pry_instance.output.puts(
    "#{pry_instance.eval_string}...exception encountered, going interactive!"
  )
  interactive_mode(pry_instance)
end