1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
# frozen_string_literal: true
require_relative "../command"
module Byebug
#
# Interrupting execution of current thread.
#
class InterruptCommand < Command
self.allow_in_control = true
def self.regexp
/^\s*int(?:errupt)?\s*$/
end
def self.description
<<-DESCRIPTION
int[errupt]
#{short_description}
DESCRIPTION
end
def self.short_description
"Interrupts the program"
end
def execute
Byebug.start
Byebug.thread_context(Thread.main).interrupt
end
end
end
|