summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorko1 <ko1@atdot.net>2023-07-29 07:28:52 +0900
committerko1 <ko1@atdot.net>2023-07-29 07:39:10 +0900
commitbcf823fddbe38e0503805a7ba6ded53c1bc1e19d (patch)
tree7983c406e09b3ce90ccca653d909c09f43158b48 /lib
parent17b50cdb68ce016caee0d6fef8e8438a5bf5addb (diff)
Revert "[rubygems/rubygems] Set thread configurations inside block"
This reverts commit db80e947a382a6a9ef2295e81f5b97c6a8ecbce7. 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
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_listener.rb4
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_poller.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/rubygems/gemcutter_utilities/webauthn_listener.rb b/lib/rubygems/gemcutter_utilities/webauthn_listener.rb
index f8158aa597..ee3fc7bcab 100644
--- a/lib/rubygems/gemcutter_utilities/webauthn_listener.rb
+++ b/lib/rubygems/gemcutter_utilities/webauthn_listener.rb
@@ -34,14 +34,14 @@ module Gem::GemcutterUtilities
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
diff --git a/lib/rubygems/gemcutter_utilities/webauthn_poller.rb b/lib/rubygems/gemcutter_utilities/webauthn_poller.rb
index 7ffd472ad3..766b38584e 100644
--- a/lib/rubygems/gemcutter_utilities/webauthn_poller.rb
+++ b/lib/rubygems/gemcutter_utilities/webauthn_poller.rb
@@ -33,12 +33,12 @@ module Gem::GemcutterUtilities
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