Sha256: 4ffdc9cd2d0a19a5495d24418b76b62c5633cda6382b9f5466856eaab81cf06f

Contents?: true

Size: 818 Bytes

Versions: 2

Compression:

Stored size: 818 Bytes

Contents

require 'byebug/command'

module Byebug
  #
  # Send custom signals to the debugged program.
  #
  class KillCommand < Command
    self.allow_in_control = true

    def regexp
      /^\s* (?:kill) \s* (?:\s+(\S+))? \s*$/x
    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
        @state.interface.close if 'KILL' == signame
      else
        return unless confirm('Really kill? (y/n) ')
        signame = 'KILL'
      end

      Process.kill(signame, Process.pid)
    end

    def description
      <<-EOD
        kill[ signal]

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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/byebug-5.0.0/lib/byebug/commands/kill.rb
byebug-5.0.0 lib/byebug/commands/kill.rb