Class: Debugger::RestartCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug-ide/commands/control.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, file_filter_supported?, #find, inherited, #initialize, load_commands, #match, method_missing, options, unescape_incoming

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/ruby-debug-ide/commands/control.rb', line 71

def help(cmd)
  %{
    restart|R [args] 
    Restart the program. This is is a re-exec - all debugger state
    is lost. If command arguments are passed those are used.
  }
end

.help_commandObject



67
68
69
# File 'lib/ruby-debug-ide/commands/control.rb', line 67

def help_command
  'restart'
end

Instance Method Details

#executeObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ruby-debug-ide/commands/control.rb', line 49

def execute
  if not defined? Debugger::RDEBUG_SCRIPT or not defined? Debugger::ARGV
    print "We are not in a context we can restart from.\n"
    return
  end
  if @match[2]
    args = Debugger::PROG_SCRIPT + " " + @match[2]
  else
    args = Debugger::ARGV.join(" ")
  end

  # An execv would be preferable to the "exec" below.
  cmd = Debugger::RDEBUG_SCRIPT + " " + args
  print "Re exec'ing:\n\t#{cmd}\n"
  exec cmd
end

#regexpObject



41
42
43
44
45
46
47
# File 'lib/ruby-debug-ide/commands/control.rb', line 41

def regexp
  / ^\s*
  (restart|R)
  (\s+ \S+ .*)?
  $
  /x
end