From c555245e7addc85f7a7f2bb16d4456c4057b6b65 Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Mon, 25 Sep 2023 08:20:28 +0100 Subject: [PATCH] Add socket filename prefix as well as suffix --- README.md | 1 + lib/debug/config.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 3a1bdedc7..917050598 100644 --- a/README.md +++ b/README.md @@ -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_PREFIX` (`sock_prefix`): UNIX Domain Socket remote debugging: socket prefix * `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) diff --git a/lib/debug/config.rb b/lib/debug/config.rb index f2b630b80..90a4ba731 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -47,6 +47,7 @@ module DEBUGGER__ 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"], + sock_prefix: ['RUBY_DEBUG_SOCK_PREFIX', "REMOTE: UNIX Domain Socket remote debugging: socket prefix"], 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"], @@ -498,6 +499,9 @@ def self.unix_domain_socket_dir def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir) user = ENV['USER'] || 'UnknownUser' filename = "ruby-debug-#{user}" + if !CONFIG[:sock_prefix].nil? + filename = "#{CONFIG[:sock_prefix]}-#{filename}" + end if !CONFIG[:sock_suffix].nil? filename += "-#{CONFIG[:sock_suffix]}" end