diff --git a/bin/rdebug-ide b/bin/rdebug-ide index fce28c9..4e9c6b1 100755 --- a/bin/rdebug-ide +++ b/bin/rdebug-ide @@ -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, @@ -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 @@ -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 diff --git a/lib/ruby-debug-ide/commands/control.rb b/lib/ruby-debug-ide/commands/control.rb index 6fd030f..d8fba9f 100644 --- a/lib/ruby-debug-ide/commands/control.rb +++ b/lib/ruby-debug-ide/commands/control.rb @@ -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