class Byebug::RestartCommand - byebug-9.0.6 Documentation

# class Byebug::RestartCommand

Restart debugged program from within byebug.

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/restart.rb, line 19
    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 15
    def self.regexp
      /^\s* restart (?:\s+(?<args>.+))? \s*$/x
    end

short_description() click to toggle source

    # File lib/byebug/commands/restart.rb, line 30
    def self.short_description
      'Restarts the debugged program'
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/restart.rb, line 34
    def execute
      argv = [$PROGRAM_NAME]

      argv.unshift(bin_file) if Byebug.mode == :standalone

      argv += (@match[:args] ? @match[:args].shellsplit : $ARGV.compact)

      puts pr('restart.success', cmd: argv.shelljoin)
      Kernel.exec(*argv)
    end