diff --git a/exe/rdbg b/exe/rdbg index 52b93d8ce..14b5e978c 100755 --- a/exe/rdbg +++ b/exe/rdbg @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require_relative '../lib/debug/config' -config = DEBUGGER__::Config::parse_argv(ARGV) +config, opt = *DEBUGGER__::Config::parse_argv(ARGV) # mode is not an actual configuration option # it's only used to carry the result of parse_argv here diff --git a/lib/debug/config.rb b/lib/debug/config.rb index 5583671c4..a5af775af 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -74,7 +74,7 @@ def initialize argv raise 'Can not make multiple configurations in one process' end - config = self.class.parse_argv(argv) + config, _ = *self.class.parse_argv(argv) # apply defaults CONFIG_SET.each do |k, config_detail| @@ -277,12 +277,6 @@ def self.parse_argv argv config[key] = parse_config_value(key, val) end } - return config if !argv || argv.empty? - - if argv.kind_of? String - require 'shellwords' - argv = Shellwords.split(argv) - end require 'optparse' require_relative 'version' @@ -433,6 +427,13 @@ def self.parse_argv argv o.separator ' Please use the remote debugging feature carefully.' end + return [config, opt] if !argv || argv.empty? + + if argv.kind_of? String + require 'shellwords' + argv = Shellwords.split(argv) + end + opt.parse!(argv) if argv.empty? @@ -442,7 +443,7 @@ def self.parse_argv argv end end - config + [config, opt] end def self.config_to_env_hash config