Sha256: 58bdcb3a2cd7b18840d781b573ab2de53c592eb1b4e2c39168b6870e1110220b

Contents?: true

Size: 952 Bytes

Versions: 13

Compression:

Stored size: 952 Bytes

Contents

module Debugger

  # Implements debugger "kill" command
  class KillCommand < Command
    self.allow_in_control = true

    def regexp
      / ^\s*
         (?:kill) \s*
         (?:\s+(\S+))?\s*
         $
      /ix
    end

    def execute
      if @match[1] 
        signame = @match[1]
        unless Signal.list.member?(signame)
          errmsg("signal name #{signame} is not a signal I know about\n")
          return false
        end
        if 'KILL' == signame
            @state.interface.finalize
        end
      else
        if not confirm("Really kill? (y/n) ")
          return
        else 
          signame = 'KILL'
        end
      end
      Process.kill(signame, Process.pid)
    end

    class << self
      def help_command
        %w[kill]
      end

      def help(cmd)
        %{
          kill [SIGNAL]

          Send [signal] to Process.pid
Equivalent of Process.kill(Process.pid)
         }
      end
    end
  end
end

Version data entries

13 entries across 12 versions & 3 rubygems

Version Path
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/debugger-1.6.8/lib/ruby-debug/commands/kill.rb
debugger-1.6.8 lib/ruby-debug/commands/kill.rb
debugger-1.6.7 lib/ruby-debug/commands/kill.rb
debugger-1.6.6 lib/ruby-debug/commands/kill.rb
debugger-1.6.5 lib/ruby-debug/commands/kill.rb
debugger-1.6.4 lib/ruby-debug/commands/kill.rb
debugger-1.6.3 lib/ruby-debug/commands/kill.rb
debugger-1.6.2 lib/ruby-debug/commands/kill.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/debugger-1.6.1/lib/ruby-debug/commands/kill.rb
candlepin-api-0.4.0 bundle/ruby/gems/debugger-1.6.1/lib/ruby-debug/commands/kill.rb
debugger-1.6.1 lib/ruby-debug/commands/kill.rb
debugger-1.6.0 lib/ruby-debug/commands/kill.rb
debugger-1.5.0 lib/ruby-debug/commands/kill.rb