class Byebug::RestartCommand
Restart debugged program from within byebug.
Public Class Methods
description()
click to toggle source
# File lib/byebug/commands/restart.rb, line 23 def self.description <<-EOD restart [args] #{short_description} This is a re-exec - all byebug state is lost. If command arguments are passed those are used. EOD end
regexp()
click to toggle source
# File lib/byebug/commands/restart.rb, line 19 def self.regexp /^\s* restart (?:\s+(?<args>.+))? \s*$/x end
short_description()
click to toggle source
# File lib/byebug/commands/restart.rb, line 34 def self.short_description 'Restarts the debugged program' end
Public Instance Methods
execute()
click to toggle source
# File lib/byebug/commands/restart.rb, line 38 def execute cmd = [$PROGRAM_NAME] cmd = prepend_byebug_bin(cmd) cmd = prepend_ruby_bin(cmd) cmd += (@match[:args] ? @match[:args].shellsplit : $ARGV) puts pr('restart.success', cmd: cmd.shelljoin) Kernel.exec(*cmd) end
Private Instance Methods
prepend_byebug_bin(cmd)
click to toggle source
# File lib/byebug/commands/restart.rb, line 52 def prepend_byebug_bin(cmd) cmd.unshift(bin_file) if Byebug.mode == :standalone cmd end
prepend_ruby_bin(cmd)
click to toggle source
# File lib/byebug/commands/restart.rb, line 57 def prepend_ruby_bin(cmd) cmd.unshift(RbConfig.ruby) if which('ruby') != which(cmd.first) cmd end