-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow adding a suffix to sockets for easier multiple-socket debugging #1017
Conversation
simple question: We can also use "prefix". |
No reason to not have both prefix and suffix. I'll update the PR with that. |
I don't know of options for any other tools (I only use Ruby and don't know of any other similar facilities for Ruby). I've added prefix now too though. |
76fb156
to
c555245
Compare
@ko1 I think this needs your approval again to run. Thanks. |
I don't ask to add PREFIX too. I want to know PREFIX or SUFFIX which is preferable. I think both is too much. To determine this kind of decision, checking other tools is good idea in general. I understand you want to make clear that which UNIX domain socket is what you want to attach. So the main reason is "naming". Now, debug.gem support to return information about UNIX domain socket with "info" request to debug server: https://github.com/ruby/debug/blob/master/lib/debug/server.rb#L132C11-L132C11 But supporting on vscode-extension needs some more time. My idea is:
If vscode extension supports (2), we can see richer one. |
I'm not clear, if we're doing (2) then why do we need (3)? I can then update the VS Code extension to prefix each line in the picker (based on my existing PR on that project) to list them in the format "name: .../filename". That does seem nicer, so I'll rework this PR to be that. |
Having just looked at it, there's no way I understand the codebase enough to do this... If you could give me any tips on a) where to add to the info command and b) how to test this locally without using VS Code as the client, I'd appreciate it (and could then continue). Failing that, me and my team will just have to run with the forked gem and locally installed VS Code extension as it gets us moving nicely for now... |
We don't need to wait vscode extension update. |
On this PR, you only need to rename |
So just like that? |
Are you waiting for me to raise a separate PR to implement the changes to the info call, or are you going to do that? Thanks. |
lib/debug/config.rb
Outdated
if !CONFIG[:sock_prefix].nil? | ||
filename = "#{CONFIG[:sock_prefix]}-#{filename}" | ||
end | ||
if !CONFIG[:sock_suffix].nil? | ||
filename += "-#{CONFIG[:sock_suffix]}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On this PR, you only need to rename
PREFIX/SUFFIX
toSESSION_NAME
(and maybe prefix will be nice).
I think what Koichi meant here was:
if !CONFIG[:sock_prefix].nil? | |
filename = "#{CONFIG[:sock_prefix]}-#{filename}" | |
end | |
if !CONFIG[:sock_suffix].nil? | |
filename += "-#{CONFIG[:sock_suffix]}" | |
end | |
if !CONFIG[:session_name].nil? | |
filename = "#{CONFIG[:session_name]}-#{filename}" | |
end |
lib/debug/config.rb
Outdated
@@ -46,6 +46,8 @@ 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_prefix: ['RUBY_DEBUG_SOCK_PREFIX', "REMOTE: UNIX Domain Socket remote debugging: socket prefix"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sock_prefix: ['RUBY_DEBUG_SOCK_PREFIX', "REMOTE: UNIX Domain Socket remote debugging: socket prefix"], |
README.md
Outdated
@@ -501,6 +500,8 @@ 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_SESSION_NAME` (`session_name`): UNIX Domain Socket remote debugging: session name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/ruby/debug/blob/master/CONTRIBUTING.md#to-update-readme
This project generates
README.md
from the templatemisc/README.md.erb
So do not directly update
README.md
. Instead, you should update the template's source and run$ raketo reflect the changes on
README.md
.
I'd also suggest dropping all the unrelated formatting changes (removing $
, extra newlines, etc).
I've got to be honest @eugeneius and @ko1 , I really don't understand what I'm doing here then. I've removed the changes from README.md (I believe they're now pulled in by README.md.erb), and removed the suffix/prefix stuff, so we just have a new "session name" setting, but is that really it?! All this PR does is add a single line to a new config option? Feels like that could have been done as part of the PR (whoever is doing it, I don't mind doing it - if someone can point me roughly where to start looking) to add it to the info command. |
I was trying to suggest removing the changes related to |
Thank you @andyjeffries and @eugeneius to discuss. I make another PR to merge this feature. |
No issue raised
Done
Description
In one of my projects (actually most, but this one in particular is what I'm working on it for) I use a Procfile with Overmind to launch both a web process and a worker process. However, at the moment I can't tell which socket is for which process.
This PR means that I can use a Procfile in the following format:
And the output of
bundle exec rdbg --util=list-socks
(which is used by VS Code for example) will change from:to:
This makes it much more obvious which socket is for which process. I'm going to raise a PR in the extension's project over there too (to trim out the matching stuff at the start), but this will be vital in making this use case work.