Skip to content

Commit 66a5035

Browse files
josegomezrko1
authored andcommitted
Improved stability for chrome debugging
- Display the greeting message regardless of the status of invocation of chrome. This allows coming back to the debugger on a new tab when the window process by `UI_CDP.run_new_chrome` is killed. - Handle `Errno::ESRCH` in `UI_CDP.cleanup_reader`. When the process by `UI_CDP.run_new_chrome` is killed, re-killing it breaks your debugging session and in turn the "debugee".
1 parent 6f79d2a commit 66a5035

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/debug/server.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,13 @@ def chrome_setup
406406
require_relative 'server_cdp'
407407

408408
@uuid = SecureRandom.uuid
409-
unless @chrome_pid = UI_CDP.setup_chrome(@local_addr.inspect_sockaddr, @uuid)
410-
DEBUGGER__.warn <<~EOS
411-
With Chrome browser, type the following URL in the address-bar:
409+
@chrome_pid = UI_CDP.setup_chrome(@local_addr.inspect_sockaddr, @uuid)
410+
DEBUGGER__.warn <<~EOS
411+
With Chrome browser, type the following URL in the address-bar:
412412
413-
devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=#{@local_addr.inspect_sockaddr}/#{@uuid}
413+
devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=#{@local_addr.inspect_sockaddr}/#{@uuid}
414414
415-
EOS
416-
end
415+
EOS
417416
end
418417

419418
def accept

lib/debug/server_cdp.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ def deactivate_bp
663663
def cleanup_reader
664664
super
665665
Process.kill :KILL, @chrome_pid if @chrome_pid
666+
rescue Errno::ESRCH # continue if @chrome_pid process is not found
666667
end
667668

668669
## Called by the SESSION thread

0 commit comments

Comments
 (0)