kitty_tests, shell-integration: rework getpwuid() exceptions suppression

This commit is contained in:
usertam
2023-03-20 03:31:23 +08:00
parent 5f9b520ca0
commit 08fa7f19f7
3 changed files with 4 additions and 5 deletions

View File

@@ -22,10 +22,9 @@ 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 login_shell
login_shell = pwd.getpwuid(os.geteuid()).pw_shell
except KeyError:
with contextlib.suppress(Exception):
print('Failed to read login shell via getpwuid() for current user, falling back to', login_shell, file=sys.stderr)
pass
export_home_cmd = b'EXPORT_HOME_CMD'
if export_home_cmd:
HOME = base64.standard_b64decode(export_home_cmd).decode('utf-8')