Module: DEBUGGER__::TrapInterceptor

Defined in:
lib/debug/session.rb

Instance Method Summary collapse

Instance Method Details

#trap(sig, *command, &command_proc) ⇒ Object



2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
# File 'lib/debug/session.rb', line 2559

def trap sig, *command, &command_proc
  sym =
    case sig
    when String
      sig.to_sym
    when Integer
      Signal.signame(sig)&.to_sym
    else
      sig
    end

  case sym
  when :INT, :SIGINT
    if defined?(SESSION) && SESSION.active? && SESSION.intercept_trap_sigint?
      return SESSION.save_int_trap(command.empty? ? command_proc : command.first)
    end
  end

  super
end