Sha256: e647d2831689ff676ddef4be19718e89a14ef145ea6eefbe0b4b13e99ab6a625

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

# frozen_string_literal: true
module Byebug
  #
  # Interface class for standard byebug use.
  #
  class LocalInterface < Interface
    EOF_ALIAS = 'continue'.freeze

    def initialize
      super()
      @input = STDIN
      @output = STDOUT
      @error = STDERR
    end

    #
    # Reads a single line of input using Readline. If Ctrl-C is pressed in the
    # middle of input, the line is reset to only the prompt and we ask for input
    # again. If Ctrl-D is pressed, it returns "continue".
    #
    # @param prompt Prompt to be displayed.
    #
    def readline(prompt)
      Readline.readline(prompt, false) || EOF_ALIAS
    rescue Interrupt
      puts('^C')
      retry
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
byebug-8.2.2 lib/byebug/interfaces/local_interface.rb