Skip to content
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
2 changes: 1 addition & 1 deletion exe/rdbg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 9 additions & 8 deletions lib/debug/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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?
Expand All @@ -442,7 +443,7 @@ def self.parse_argv argv
end
end

config
[config, opt]
end

def self.config_to_env_hash config
Expand Down