debug icon indicating copy to clipboard operation
debug copied to clipboard

Support interactive `rdbg -A` when there are multiple sockets

Open st0012 opened this issue 3 years ago • 5 comments

Your proposal

Allow selecting socket files in rdbg -A when there are multiple socket files, instead of just listing them.

The UI can be similar to:

st0012 avatar Jul 24 '22 17:07 st0012

I think we can't choose the sockets without using ps or some other tools to know which socket is the correct socket. So I think this kind of UI doesn't help.

ko1 avatar Jul 25 '22 07:07 ko1

I thought it's just listing socket files and select one of them?

I implemented a demo with the cli-ui gem.

https://user-images.githubusercontent.com/5079556/180744888-553d6cda-7767-4095-8543-31142474eee5.mov

Code change:

         else
-          $stderr.puts "Please select a debug session:"
-          files.each{|f|
-            $stderr.puts "  #{File.basename(f)}"
-          }
-          exit
+          require "cli/ui"
+          CLI::UI::Prompt.ask('Please select a debug session:') do |handler|
+            files.each do |file|
+              handler.option(file) { |selection| @s = Socket.unix(selection) }
+            end
+          end
         end

Of course I'm not saying we should rely on the cli-ui for this feature. I just want to demonstrate that it should be possible.

st0012 avatar Jul 25 '22 09:07 st0012

I meant it is hard to choose the file by users with only from socket file name.

ko1 avatar Jul 27 '22 06:07 ko1

It depends on the setup because the debugger allows setting custom socket name. For example we have serverand worker in the socket names so it's helpful in my company. And also by default the socket name is displayed at the debuggee start, so it should be helpful in general.

st0012 avatar Jul 28 '22 09:07 st0012

Yes it depends.

ko1 avatar Jul 29 '22 06:07 ko1