From 47d7e812a3cdc42accc7e6bb2ad4dff3a6686012 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 19 Mar 2023 17:20:09 +0530 Subject: [PATCH] Cleanup previous PR --- shell-integration/ssh/bootstrap.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell-integration/ssh/bootstrap.py b/shell-integration/ssh/bootstrap.py index 9c73f2e54..47712ce3b 100644 --- a/shell-integration/ssh/bootstrap.py +++ b/shell-integration/ssh/bootstrap.py @@ -20,11 +20,11 @@ echo_on = int('ECHO_ON') data_dir = shell_integration_dir = '' request_data = int('REQUEST_DATA') leading_data = b'' +login_shell = os.environ.get('SHELL') or '/bin/sh' try: - login_shell = pwd.getpwuid(os.geteuid()).pw_shell or os.environ.get('SHELL') or '/bin/sh' + login_shell = pwd.getpwuid(os.geteuid()).pw_shell or login_shell except KeyError: - login_shell = os.environ.get('SHELL') or '/bin/sh' - with suppress(Exception): + with contextlib.suppress(Exception): print('Failed to read login shell via getpwuid() for current user, falling back to', login_shell, file=sys.stderr) export_home_cmd = b'EXPORT_HOME_CMD' if export_home_cmd: