Skip to content

Commit

Permalink
Revert "[rubygems/rubygems] Set thread configurations inside block"
Browse files Browse the repository at this point in the history
This reverts commit db80e94.

This patch uses `Thread.abort_on_exception = true` and it affects
all of threads. This is why CI systems fails.

How to modify:

- use `thread.abort_on_exception = true` for specific threads
- Run this code in a separated process
  • Loading branch information
ko1 committed Jul 28, 2023
1 parent 17b50cd commit bcf823f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/rubygems/gemcutter_utilities/webauthn_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ def initialize(host)

def self.listener_thread(host, server)
thread = Thread.new do
Thread.abort_on_exception = true
Thread.report_on_exception = false
Thread.current[:otp] = new(host).wait_for_otp_code(server)
rescue Gem::WebauthnVerificationError => e
Thread.current[:error] = e
ensure
server.close
end
thread.abort_on_exception = true
thread.report_on_exception = false

thread
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/gemcutter_utilities/webauthn_poller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def initialize(options, host)

def self.poll_thread(options, host, webauthn_url, credentials)
thread = Thread.new do
Thread.abort_on_exception = true
Thread.report_on_exception = false
Thread.current[:otp] = new(options, host).poll_for_otp(webauthn_url, credentials)
rescue Gem::WebauthnVerificationError, Timeout::Error => e
Thread.current[:error] = e
end
thread.abort_on_exception = true
thread.report_on_exception = false

thread
end
Expand Down

0 comments on commit bcf823f

Please sign in to comment.