Class: Byebug::KillCommand
Overview
Send custom signals to the debugged program.
Instance Attribute Summary
Attributes inherited from Command
#processor
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
#arguments, columnize, #context, #frame, help, #initialize, match, to_s
#camelize, #prettify
Class Method Details
.description ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/byebug/commands/kill.rb', line 14
def self.description
<<-EOD
kill[ signal]
#{short_description}
Equivalent of Process.kill(Process.pid)
EOD
end
|
.regexp ⇒ Object
10
11
12
|
# File 'lib/byebug/commands/kill.rb', line 10
def self.regexp
/^\s* (?:kill) \s* (?:\s+(\S+))? \s*$/x
end
|
.short_description ⇒ Object
24
25
26
|
# File 'lib/byebug/commands/kill.rb', line 24
def self.short_description
'Sends a signal to the current process'
end
|
Instance Method Details
#execute ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/byebug/commands/kill.rb', line 28
def execute
if @match[1]
signame = @match[1]
unless Signal.list.member?(signame)
return errmsg("signal name #{signame} is not a signal I know about\n")
end
else
return unless confirm('Really kill? (y/n) ')
signame = 'KILL'
end
processor.interface.close if 'KILL' == signame
Process.kill(signame, Process.pid)
end
|