Sha256: 9728bbb2e18d558bd1d853c776834103fd2860e06c328a27532f7ae5ff29a64e

Contents?: true

Size: 930 Bytes

Versions: 8

Compression:

Stored size: 930 Bytes

Contents

module Byebug

  # Implements byebug "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 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

8 entries across 8 versions & 1 rubygems

Version Path
byebug-1.8.2 lib/byebug/commands/kill.rb
byebug-1.8.1 lib/byebug/commands/kill.rb
byebug-1.8.0 lib/byebug/commands/kill.rb
byebug-1.7.0 lib/byebug/commands/kill.rb
byebug-1.6.1 lib/byebug/commands/kill.rb
byebug-1.6.0 lib/byebug/commands/kill.rb
byebug-1.5.0 lib/byebug/commands/kill.rb
byebug-1.4.2 lib/byebug/commands/kill.rb