Sha256: 598eb752c670e3624e33748eecf7dfd34d27c99c271f7ddaaf6208f0207abdec

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

module Debugger
  class QuitCommand < Command
    self.control = true

    def regexp
      /^\s*q(?:uit)?\s*$/
    end

    def execute
      if confirm("Really quit? (y/n) ")
        exit! # exit -> exit!: No graceful way to stop threads...
      end
    end

    class << self
      def help_command
        'quit'
      end

      def help(cmd)
        %{
          q[uit]\texit from debugger
        }
      end
    end
  end
  
  class InterruptCommand < Command
    self.event = false
    self.control = true
    
    def regexp
      /^\s*i(?:nterrupt)?\s*$/
    end
    
    def execute
      unless Debugger.interrupt_last
        context = Debugger.contexts.find{ |c| c.thread == Thread.main }
        context.interrupt
      end
    end
    
    class << self
      def help_command
        'interrupt'
      end
      
      def help(cmd)
        %{
          i[nterrupt]\tinterrupt the program
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-debug-0.3-mswin32 lib/ruby-debug/commands/control.rb
ruby-debug-0.3 lib/ruby-debug/commands/control.rb