summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJenny Shen <jenny.shen@shopify.com>2023-02-21 12:37:33 -0500
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-12 11:58:03 +0900
commitb909ca94bde1d547467ddf7bd5431a3399b542ee (patch)
treec17986fb76f075e424e7501abd297c208c1b3591 /lib
parentc7a8d63df84c4884cb30cc58292ec36efabfabbb (diff)
downloadruby-b909ca94bde1d547467ddf7bd5431a3399b542ee.tar.gz
Terminate interaction after wait for otp thread completes to support jruby
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/gemcutter_utilities.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index e66fd0e60f..046bf5da50 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -267,8 +267,7 @@ module Gem::GemcutterUtilities
thread = Thread.new do
Thread.current[:otp] = Gem::WebauthnListener.wait_for_otp_code(host, server)
rescue Gem::WebauthnVerificationError => e
- alert_error e.message
- terminate_interaction(1)
+ Thread.current[:error] = e
end
thread.abort_on_exception = true
thread.report_on_exception = false
@@ -277,6 +276,11 @@ module Gem::GemcutterUtilities
say "You have enabled multi-factor authentication. Please visit #{url_with_port} to authenticate via security device."
thread.join
+ if error = thread[:error]
+ alert_error error.message
+ terminate_interaction(1)
+ end
+
say "You are verified with a security device. You may close the browser window."
thread[:otp]
end