From 7bed66a458be0f8b1f8d9f9802158f7c85667f0e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 27 Dec 2019 12:16:58 +0530 Subject: [PATCH] Ensure ans is set in read_shell_environment Fixes #2232 --- kitty/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kitty/main.py b/kitty/main.py index 6736b3326..bdccc014f 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -201,6 +201,7 @@ def macos_cmdline(argv_args): def read_shell_environment(opts=None): if not hasattr(read_shell_environment, 'ans'): + ans = read_shell_environment.ans = {} import subprocess from .session import resolved_shell shell = resolved_shell(opts) @@ -234,14 +235,12 @@ def read_shell_environment(opts=None): break raw += x raw = raw.decode('utf-8', 'replace') - ans = read_shell_environment.ans = {} for line in raw.splitlines(): k, v = line.partition('=')[::2] if k and v: ans[k] = v else: log_error('Failed to run shell to read its environment') - read_shell_environment.ans = {} return read_shell_environment.ans