lib/debug/local.rb in debug-1.1.0 vs lib/debug/local.rb in debug-1.2.0

- old
+ new

@@ -5,38 +5,33 @@ module DEBUGGER__ class UI_LocalConsole < UI_Base def initialize @console = Console.new + end + def remote? + false + end + + def activate session, on_fork: false unless CONFIG[:no_sigint_hook] - @prev_handler = trap(:SIGINT){ - if SESSION.active? + prev_handler = trap(:SIGINT){ + if session.active? ThreadClient.current.on_trap :SIGINT end } + session.intercept_trap_sigint_start prev_handler end end - def close - if @prev_handler - trap(:SIGINT, @prev_handler) + def deactivate + if SESSION.intercept_trap_sigint? + trap(:SIGINT, SESSION.intercepted_sigint_cmd) 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 @@ -74,18 +69,20 @@ (@console.readline(prompt) || 'quit').strip end end def setup_interrupt - current_thread = Thread.current # should be session_server thread + SESSION.intercept_trap_sigint false do + current_thread = Thread.current # should be session_server thread - prev_handler = trap(:INT){ - current_thread.raise Interrupt - } + prev_handler = trap(:INT){ + current_thread.raise Interrupt + } - yield - ensure - trap(:INT, prev_handler) + yield + ensure + trap(:INT, prev_handler) + end end end end