From 9c25a183db60dd72a19aae58b08bad2927ce7504 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 25 Oct 2023 12:12:16 +0530 Subject: [PATCH] On second thoughts dont use foreground process env vars for kitten @ ls Since the purpose of the env vars is mostly to recognize windows the original env vars make more sense. Also I dislike changing behavior for no good reason. --- docs/changelog.rst | 3 +-- kitty/child.py | 4 ++-- kitty/window.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 731bb7e54..02dcfc2c5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -78,8 +78,7 @@ Detailed list of changes - Render Private Use Unicode symbols using two cells if the second cell contains a non-breaking space as well as a normal space -- kitten @ ls: Return the environment of the foreground process instead of the initial child process (:iss:`6749`) - +- macOS: Fix a regression in the previous release that caused kitten @ ls to not report the environment variables for the default shell (:iss:`6749`) 0.30.1 [2023-10-05] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/child.py b/kitty/child.py index bca6a49b4..dd29d5fbf 100644 --- a/kitty/child.py +++ b/kitty/child.py @@ -386,9 +386,9 @@ class Child: def environ(self) -> Dict[str, str]: try: assert self.pid is not None - return environ_of_process(self.pid) + return environ_of_process(self.pid) or self.final_env.copy() except Exception: - return {} + return self.final_env.copy() @property def current_cwd(self) -> Optional[str]: diff --git a/kitty/window.py b/kitty/window.py index f9cc734b7..e826cb499 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -654,7 +654,7 @@ class Window: 'pid': self.child.pid, 'cwd': self.child.current_cwd or self.child.cwd, 'cmdline': self.child.cmdline, - 'env': self.child.foreground_environ or self.child.environ or self.child.final_env, + 'env': self.child.environ or self.child.final_env, 'foreground_processes': self.child.foreground_processes, 'is_self': is_self, 'at_prompt': self.at_prompt,