File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ use rand::Rng;
167167
168168use std:: default:: Default ;
169169use std:: net:: ToSocketAddrs ;
170+ use std:: process:: Command ;
170171use std:: sync:: { Arc , Mutex , RwLock } ;
171172use std:: time:: { Duration , Instant , SystemTime , UNIX_EPOCH } ;
172173
@@ -333,6 +334,16 @@ impl Node {
333334 listeners. push ( listener) ;
334335 } ,
335336 Err ( e) => {
337+ println ! ( "Failed to bind to port {}" , addr) ;
338+
339+ // On Linux/macOS
340+ let output = Command :: new ( "lsof" )
341+ . args ( & [ "-i" , & format ! ( ":{}" , & addr. port( ) ) ] )
342+ . output ( )
343+ . expect ( "failed to execute lsof" ) ;
344+
345+ println ! ( "{}" , String :: from_utf8_lossy( & output. stdout) ) ;
346+
336347 log_error ! (
337348 logger,
338349 "Failed to bind to {}: {} - is something else already listening?" ,
You can’t perform that action at this time.
0 commit comments