Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--keep-process-alive flag (closes #199) #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/rdebug-ide
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ options = OpenStruct.new(
'stop' => false,
'tracing' => false,
'skip_wait_for_start' => false,
'keep_process_alive' => false,
'int_handler' => true,
'dispatcher_port' => -1,
'evaluation_timeout' => 10,
Expand Down Expand Up @@ -70,6 +71,7 @@ EOB
opts.on('--stop', 'stop when the script is loaded') {options.stop = true}
opts.on("-x", "--trace", "turn on line tracing") {options.tracing = true}
opts.on("--skip_wait_for_start", "skip wait for 'start' command") {options.skip_wait_for_start = true}
opts.on("--keep-process-alive", "don't exit the process when debugger is exited") {options.keep_process_alive = true}
opts.on("-l", "--load-mode", "load mode (experimental)") {options.load_mode = true}
opts.on("-d", "--debug", "Debug self - prints information for debugging ruby-debug itself") do
Debugger.cli_debug = true
Expand Down Expand Up @@ -167,6 +169,10 @@ if options.int_handler
trap('INT') { Debugger.interrupt_last }
end

if options.keep_process_alive
ENV['DEBUGGER_KEEP_PROCESS_ALIVE'] = "true"
end

# set options
Debugger.keep_frame_binding = options.frame_bind
Debugger.tracing = options.tracing
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby-debug-ide/commands/control.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def execute
@printer.print_msg("finished")
@printer.print_debug("Exiting debugger.")
ensure
exit! # exit -> exit!: No graceful way to stop threads...
exit! unless ENV['DEBUGGER_KEEP_PROCESS_ALIVE'] == "true" # exit -> exit!: No graceful way to stop threads...
end
end

Expand Down