Ignore invalid language names returned by the coca framework on macOS
This commit is contained in:
Kovid Goyal 2017-07-16 22:49:05 +05:30
parent abca9280e7
commit 304d42d4c2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -241,7 +241,17 @@ def ensure_osx_locale():
def main():
if isosx:
ensure_osx_locale()
locale.setlocale(locale.LC_ALL, '')
try:
locale.setlocale(locale.LC_ALL, '')
except Exception:
if not isosx:
raise
print('Failed to set locale with LANG:', os.environ.get('LANG'), file=sys.stderr)
os.environ.pop('LANG')
try:
locale.setlocale(locale.LC_ALL, '')
except Exception:
print('Failed to set locale with no LANG, ignoring', file=sys.stderr)
if os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES',
None) == '1' and getattr(sys, 'frozen', True):
os.chdir(os.path.expanduser('~'))