Restore invalid LANG after trying to get python to set the locale without it
This commit is contained in:
parent
0f734719e7
commit
21446e36c1
@ -338,11 +338,13 @@ def set_locale() -> None:
|
|||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
except Exception:
|
except Exception:
|
||||||
log_error('Failed to set locale with LANG:', os.environ.get('LANG'))
|
log_error('Failed to set locale with LANG:', os.environ.get('LANG'))
|
||||||
if os.environ.pop('LANG', None) is not None:
|
old_lang = os.environ.pop('LANG', None)
|
||||||
|
if old_lang is not None:
|
||||||
try:
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
except Exception:
|
except Exception:
|
||||||
log_error('Failed to set locale with no LANG')
|
log_error('Failed to set locale with no LANG')
|
||||||
|
os.environ['LANG'] = old_lang
|
||||||
|
|
||||||
|
|
||||||
def _main() -> None:
|
def _main() -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user