Skip to content

Commit

Permalink
Allow adding a suffix to sockets for easier multiple-socket debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjeffries committed Sep 13, 2023
1 parent 0462225 commit 2ab4d9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ config set no_color true
* `RUBY_DEBUG_HOST` (`host`): TCP/IP remote debugging: host (default: 127.0.0.1)
* `RUBY_DEBUG_SOCK_PATH` (`sock_path`): UNIX Domain Socket remote debugging: socket path
* `RUBY_DEBUG_SOCK_DIR` (`sock_dir`): UNIX Domain Socket remote debugging: socket directory
* `RUBY_DEBUG_SOCK_SUFFIX` (`sock_suffix`): UNIX Domain Socket remote debugging: socket suffix
* `RUBY_DEBUG_LOCAL_FS_MAP` (`local_fs_map`): Specify local fs map
* `RUBY_DEBUG_SKIP_BP` (`skip_bp`): Skip breakpoints if no clients are attached (default: false)
* `RUBY_DEBUG_COOKIE` (`cookie`): Cookie for negotiation
Expand Down
7 changes: 6 additions & 1 deletion lib/debug/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module DEBUGGER__
host: ['RUBY_DEBUG_HOST', "REMOTE: TCP/IP remote debugging: host", :string, "127.0.0.1"],
sock_path: ['RUBY_DEBUG_SOCK_PATH', "REMOTE: UNIX Domain Socket remote debugging: socket path"],
sock_dir: ['RUBY_DEBUG_SOCK_DIR', "REMOTE: UNIX Domain Socket remote debugging: socket directory"],
sock_suffix: ['RUBY_DEBUG_SOCK_SUFFIX', "REMOTE: UNIX Domain Socket remote debugging: socket suffix"],
local_fs_map: ['RUBY_DEBUG_LOCAL_FS_MAP', "REMOTE: Specify local fs map", :path_map],
skip_bp: ['RUBY_DEBUG_SKIP_BP', "REMOTE: Skip breakpoints if no clients are attached", :bool, 'false'],
cookie: ['RUBY_DEBUG_COOKIE', "REMOTE: Cookie for negotiation"],
Expand Down Expand Up @@ -496,7 +497,11 @@ def self.unix_domain_socket_dir

def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir)
user = ENV['USER'] || 'UnknownUser'
File.join(base_dir, "ruby-debug-#{user}")
filename = "ruby-debug-#{user}"
if !CONFIG[:sock_suffix].nil?
filename += "-#{CONFIG[:sock_suffix]}"
end
File.join(base_dir, filename)
end

def self.create_unix_domain_socket_name(base_dir = unix_domain_socket_dir)
Expand Down

0 comments on commit 2ab4d9f

Please sign in to comment.