Fix a regression in 0.26.0 that caused kitty to no longer set the LANG environment variable on macOS
Happened because reading the locale uses cocoa APIs and they are not fork safe, so it was moved to after prewarm forking, but at that point the default child env had already been set. Fixes #5439
This commit is contained in:
parent
6253ee2a74
commit
22fbdbca40
@ -40,6 +40,8 @@ Detailed list of changes
|
||||
|
||||
- ssh kitten: Fix executable permission missing from kitty bootstrap script (:iss:`5438`)
|
||||
|
||||
- Fix a regression in 0.26.0 that caused kitty to no longer set the ``LANG`` environment variable on macOS (:iss:`5439`)
|
||||
|
||||
0.26.0 [2022-08-29]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@ -168,6 +168,10 @@ def set_default_env(val: Optional[Dict[str, str]] = None) -> None:
|
||||
setattr(default_env, 'lc_ctype_set_by_user', has_lctype)
|
||||
|
||||
|
||||
def set_LANG_in_default_env(val: str) -> None:
|
||||
default_env()['LANG'] = val
|
||||
|
||||
|
||||
def openpty() -> Tuple[int, int]:
|
||||
master, slave = os.openpty() # Note that master and slave are in blocking mode
|
||||
os.set_inheritable(slave, True)
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import Dict, Generator, List, Optional, Sequence, Tuple
|
||||
|
||||
from .borders import load_borders_program
|
||||
from .boss import Boss
|
||||
from .child import set_default_env
|
||||
from .child import set_default_env, set_LANG_in_default_env
|
||||
from .cli import create_opts, parse_args
|
||||
from .cli_stub import CLIOptions
|
||||
from .conf.utils import BadLine
|
||||
@ -229,6 +229,7 @@ def ensure_macos_locale() -> None:
|
||||
else:
|
||||
log_error(f'Could not set LANG Cocoa returns language as: {lang}')
|
||||
os.environ['LANG'] = f'{lang}.UTF-8'
|
||||
set_LANG_in_default_env(os.environ['LANG'])
|
||||
|
||||
|
||||
@contextmanager
|
||||
@ -368,6 +369,7 @@ def set_locale() -> None:
|
||||
except Exception:
|
||||
log_error('Failed to set locale with no LANG')
|
||||
os.environ['LANG'] = old_lang
|
||||
set_LANG_in_default_env(old_lang)
|
||||
|
||||
|
||||
def _main() -> None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user