Sha256: e754ec1d3b9ef6502c492b25b6e033f6271c66fedd7d161d27aa1681a8cd0dc0
Contents?: true
Size: 1.51 KB
Versions: 4
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true require 'io/console/size' require_relative 'console' module DEBUGGER__ class UI_LocalConsole < UI_Base def initialize @console = Console.new unless CONFIG[:no_sigint_hook] @prev_handler = trap(:SIGINT){ if SESSION.active? ThreadClient.current.on_trap :SIGINT end } end end def close if @prev_handler trap(:SIGINT, @prev_handler) end end def remote? false end def activate on_fork: false # Do nothing end def deactivate # Do nothing end def width if (w = IO.console_size[1]) == 0 # for tests PTY 80 else w end end def quit n exit n end def ask prompt setup_interrupt do print prompt ($stdin.gets || '').strip end end def puts str = nil case str when Array str.each{|line| $stdout.puts line.chomp } when String str.each_line{|line| $stdout.puts line.chomp } when nil $stdout.puts end end def readline prompt = '(rdbg)' setup_interrupt do (@console.readline(prompt) || 'quit').strip end end def setup_interrupt current_thread = Thread.current # should be session_server thread prev_handler = trap(:INT){ current_thread.raise Interrupt } yield ensure trap(:INT, prev_handler) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
debug-1.1.0 | lib/debug/local.rb |
debug-1.0.0 | lib/debug/local.rb |
debug-1.0.0.rc2 | lib/debug/local.rb |
debug-1.0.0.rc1 | lib/debug/local.rb |