From 89e5ae28bb60d5bf3aaadf25d62ea0864e5136bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Nov 2017 00:40:21 +0530 Subject: [PATCH] Dont fail to start if the user's /etc/passwd is missing an entry for the current uid Appears to happen on some nix systems. Fixes #178 --- kitty/constants.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kitty/constants.py b/kitty/constants.py index 1cc852264..59f6faba2 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -67,7 +67,11 @@ cell_size = ViewportSize() base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) terminfo_dir = os.path.join(base_dir, 'terminfo') logo_data_file = os.path.join(base_dir, 'logo', 'kitty.rgba') -shell_path = pwd.getpwuid(os.geteuid()).pw_shell or '/bin/sh' +try: + shell_path = pwd.getpwuid(os.geteuid()).pw_shell or '/bin/sh' +except KeyError: + print('Failed to read login shell from /etc/passwd for current user, falling back to /bin/sh', file=sys.stderr) + shell_path = '/bin/sh' GLint = ctypes.c_int if ctypes.sizeof(ctypes.c_int) == 4 else ctypes.c_long GLuint = ctypes.c_uint if ctypes.sizeof(ctypes.c_uint) == 4 else ctypes.c_ulong