File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,24 @@ when :start
13
13
start_mode = config [ :remote ] ? "open" : 'start'
14
14
cmd = config [ :command ] ? ARGV . shift : ( ENV [ 'RUBY' ] || RbConfig . ruby )
15
15
16
+ if defined? ( $:. resolve_feature_path )
17
+ begin
18
+ _ , sopath = $:. resolve_feature_path ( 'debug/debug.so' )
19
+ rescue LoadError
20
+ # raises LoadError before 3.1 (2.7 and 3.0)
21
+ else
22
+ sopath = File . dirname ( File . dirname ( sopath ) ) if sopath
23
+ end
24
+ else
25
+ # `$:.resolve_feature_path` is not defined in 2.6 or earlier.
26
+ so = "debug/debug.#{ RbConfig ::CONFIG [ 'DLEXT' ] } "
27
+ sopath = $:. find { |dir | File . exist? ( File . join ( dir , so ) ) }
28
+ end
29
+ added = "-r #{ libpath } /#{ start_mode } "
30
+ added = "-I #{ sopath } #{ added } " if sopath
16
31
rubyopt = ENV [ 'RUBYOPT' ]
17
32
env = ::DEBUGGER__ ::Config . config_to_env_hash ( config )
18
- env [ 'RUBY_DEBUG_ADDED_RUBYOPT' ] = added = "-r #{ libpath } / #{ start_mode } "
33
+ env [ 'RUBY_DEBUG_ADDED_RUBYOPT' ] = added
19
34
env [ 'RUBYOPT' ] = "#{ rubyopt } #{ added } "
20
35
21
36
exec ( env , cmd , *ARGV )
You can’t perform that action at this time.
0 commit comments