Skip to content

Commit

Permalink
Retry webbrowser.open() after a TypeError (#7542)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee authored and yugangw-msft committed Oct 22, 2018
1 parent 6b1db5e commit 2d5ed6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/azure-cli-core/azure/cli/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ def open_page_in_browser(url):
# understand the "open location" message"
# b. Python 2.x can't sniff out the default browser
return subprocess.Popen(['open', url])
return webbrowser.open(url, new=2) # 2 means: open in a new tab, if possible
try:
return webbrowser.open(url, new=2) # 2 means: open in a new tab, if possible
except TypeError: # See https://bugs.python.org/msg322439
return webbrowser.open(url, new=2)


def _get_platform_info():
Expand Down

0 comments on commit 2d5ed6c

Please sign in to comment.