Class: Byebug::KillCommand
- Defined in:
- lib/byebug/commands/kill.rb
Overview
Send custom signals to the debugged program.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match
Methods included from StringFunctions
Methods included from FileFunctions
#get_line, #get_lines, #n_lines, #normalize
Methods included from ParseFunctions
#get_int, #parse_steps, #syntax_valid?
Constructor Details
This class inherits a constructor from Byebug::Command
Class Method Details
.description ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/byebug/commands/kill.rb', line 35 def description prettify <<-EOD kill[ SIGNAL] Send [signal] to Process.pid Equivalent of Process.kill(Process.pid) EOD end |
.names ⇒ Object
31 32 33 |
# File 'lib/byebug/commands/kill.rb', line 31 def names %w(kill) end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/byebug/commands/kill.rb', line 14 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 |
#regexp ⇒ Object
10 11 12 |
# File 'lib/byebug/commands/kill.rb', line 10 def regexp /^\s* (?:kill) \s* (?:\s+(\S+))? \s*$/x end |