Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 0bc23da

Browse files
committed
catch launchy exception
1 parent ce39f84 commit 0bc23da

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/cipherstash/client/auth0_device_code_credentials.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ def get_device_code_polling_info
148148
def prompt_user(polling_info)
149149
code = polling_info[:user_code]
150150

151-
Launchy.open polling_info[:verification_uri_complete]
151+
begin
152+
Launchy.open polling_info[:verification_uri_complete]
153+
rescue Launchy::CommandNotFoundError
154+
# We could be running in a headless environment, in which case, the user should just open the url in a browser on a separate machine
155+
@logger.debug("Auth0DeviceCodeCredentials#prompt_user") { "Unable to launch url in browser" }
156+
end
152157

153158
puts <<~EOF
154159
Visit \e[92m#{polling_info[:verification_uri_complete]}\e[0m to complete authentication by following the below steps:

0 commit comments

Comments
 (0)