mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Use open instead of webbrowser.open on macOS >= 10.12.5
Works around an osascript bug. Fixes #4035.
This commit is contained in:
parent
f234637e53
commit
2f5af733ba
1 changed files with 13 additions and 1 deletions
|
@ -4,10 +4,12 @@ from __future__ import unicode_literals
|
|||
from __future__ import print_function
|
||||
import binascii
|
||||
import cgi
|
||||
from distutils.version import LooseVersion
|
||||
import glob
|
||||
import multiprocessing.pool
|
||||
import operator
|
||||
import os
|
||||
import platform
|
||||
import random
|
||||
import re
|
||||
import select
|
||||
|
@ -29,6 +31,12 @@ else:
|
|||
import socketserver as SocketServer
|
||||
from urllib.parse import parse_qs
|
||||
|
||||
def isMacOS10_12_5_OrLater():
|
||||
""" Return whether this system is macOS 10.12.5 or a later version. """
|
||||
version = platform.mac_ver()[0]
|
||||
return version and LooseVersion(version) >= LooseVersion('10.12.5')
|
||||
|
||||
|
||||
# Disable CLI web browsers
|
||||
term = os.environ.pop('TERM', None)
|
||||
if term:
|
||||
|
@ -1124,9 +1132,13 @@ f.write(redirect_template_html % (url, url))
|
|||
f.close()
|
||||
|
||||
# Open temporary file as URL
|
||||
# Use open on macOS >= 10.12.5 to work around #4035.
|
||||
fileurl = 'file://' + filename
|
||||
print("Web config started at '%s'. Hit enter to stop." % fileurl)
|
||||
webbrowser.open(fileurl)
|
||||
if isMacOS10_12_5_OrLater():
|
||||
subprocess.check_call(['open', fileurl])
|
||||
else:
|
||||
webbrowser.open(fileurl)
|
||||
|
||||
# Select on stdin and httpd
|
||||
stdin_no = sys.stdin.fileno()
|
||||
|
|
Loading…
Reference in a new issue