Sha256: 6ed7c7b46906dbb1392e73b974dbd4848d06cbc8c5c9056bc67420df86454579

Contents?: true

Size: 850 Bytes

Versions: 6

Compression:

Stored size: 850 Bytes

Contents

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

    class << self
      def names
        %w(kill)
      end

      def description
        %{kill[ SIGNAL]

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-3.5.1 lib/byebug/commands/kill.rb
byebug-3.5.0 lib/byebug/commands/kill.rb
byebug-3.4.2 lib/byebug/commands/kill.rb
byebug-3.4.1 lib/byebug/commands/kill.rb
byebug-3.4.0 lib/byebug/commands/kill.rb
byebug-3.3.0 lib/byebug/commands/kill.rb