Skip to content

Commit

Permalink
Close CDP socket listener thread before closing socket
Browse files Browse the repository at this point in the history
Otherwise we are getting `IOError: stream closed in another thread` on
quit.
  • Loading branch information
p0deje committed Sep 27, 2021
1 parent 016eded commit a3e4d1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rb/lib/selenium/webdriver/devtools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ class DevTools

def initialize(url:)
@callback_threads = ThreadGroup.new

@messages = []
@session_id = nil
@url = url

process_handshake
attach_socket_listener
@socket_thread = attach_socket_listener
start_session
end

def close
@callback_threads.list.each(&:exit)
@socket_thread.exit
socket.close
end

Expand Down

0 comments on commit a3e4d1b

Please sign in to comment.