Sha256: 81def816152b71c6d0161f6ad3030168dc1ec8bc90ef65e1cee6f17ab11afa04

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

module Debugger
  class QuitCommand < Command # :nodoc:
    self.control = true

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

    def execute
      if confirm("Really quit? (y/n) ")
        Debugger.save_history if Debugger.respond_to? :save_history
        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 # :nodoc:
    self.event = false
    self.control = true
    self.context = 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

4 entries across 4 versions & 1 rubygems

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