File tree 2 files changed +25
-7
lines changed
2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ def util name
25
25
when 'list-socks'
26
26
cleanup_unix_domain_sockets
27
27
puts list_connections
28
+ when 'list-socks-verbose'
29
+ cleanup_unix_domain_sockets
30
+ puts list_connections verbose : true
28
31
when 'setup-autoload'
29
32
setup_autoload
30
33
else
@@ -91,10 +94,24 @@ def cleanup_unix_domain_sockets
91
94
end
92
95
end
93
96
94
- def list_connections
95
- Dir . glob ( DEBUGGER__ . create_unix_domain_socket_name_prefix + '*' ) . find_all do |path |
97
+ def list_connections verbose : false
98
+ socks = Dir . glob ( DEBUGGER__ . create_unix_domain_socket_name_prefix + '*' ) . find_all do |path |
96
99
File . socket? ( path )
97
100
end
101
+
102
+ if verbose
103
+ socks = socks . map { |sock_path |
104
+ Socket . unix ( sock_path ) { |sock |
105
+ sock . puts "info cookie: #{ CONFIG [ :cookie ] || '-' } "
106
+ pid = sock . gets . chomp
107
+ _dbg = sock . gets . chomp
108
+ _unm = sock . gets . chomp
109
+ [ sock_path , pid ]
110
+ }
111
+ }
112
+ end
113
+
114
+ socks
98
115
end
99
116
end
100
117
@@ -148,18 +165,18 @@ def connect_unix name = nil
148
165
end
149
166
else
150
167
Client . cleanup_unix_domain_sockets
151
- files = Client . list_connections
168
+ files = Client . list_connections verbose : true
152
169
153
170
case files . size
154
171
when 0
155
172
$stderr. puts "No debug session is available."
156
173
exit
157
174
when 1
158
- @s = Socket . unix ( files . first )
175
+ @s = Socket . unix ( files . first . first )
159
176
else
160
177
$stderr. puts "Please select a debug session:"
161
- files . each { |f |
162
- $stderr. puts " #{ File . basename ( f ) } "
178
+ files . each { |( f , desc ) |
179
+ $stderr. puts " #{ File . basename ( f ) } ( #{ desc } ) "
163
180
}
164
181
exit
165
182
end
Original file line number Diff line number Diff line change @@ -144,7 +144,8 @@ def greeting
144
144
145
145
# TODO: protocol version
146
146
if v != VERSION
147
- raise GreetingError , "Incompatible version (server:#{ VERSION } and client:#{ $1} )"
147
+ @sock . puts msg = "out DEBUGGER: Incompatible version (server:#{ VERSION } and client:#{ $1} )"
148
+ raise GreetingError , msg
148
149
end
149
150
parse_option ( params )
150
151
You can’t perform that action at this time.
0 commit comments