class Byebug::LocalInterface


Interface class for standard byebug use.

def initialize

def initialize
  super()
  @input = $stdin
  @output = $stdout
  @error = $stderr
end

def readline(prompt)

Parameters:
  • prompt () -- Prompt to be displayed.
def readline(prompt)
  with_repl_like_sigint { without_readline_completion { Readline.readline(prompt) || EOF_ALIAS } }
end

def with_repl_like_sigint

Other tags:
    Note: - Any external 'INT' traps are overriden during this method.
def with_repl_like_sigint
  orig_handler = trap("INT") { raise Interrupt }
  yield
rescue Interrupt
  puts("^C")
  retry
ensure
  trap("INT", orig_handler)
end

def without_readline_completion


making use of Readline.
dependent on them being loaded. Disable those while byebug is the REPL
Other gems, for example, IRB could've installed completion procs that are

Disable any Readline completion procs.
def without_readline_completion
  orig_completion = Readline.completion_proc
  return yield unless orig_completion
  begin
    Readline.completion_proc = ->(_) { nil }
    yield
  ensure
    Readline.completion_proc = orig_completion
  end
end