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
No known key found for this signature in database
GPG key ID: C35F5FF3A6C5AC43
3 changed files with 4 additions and 5 deletions

View file

@ -67,7 +67,7 @@ using_id() {
}
using_python() {
detect_python && output=$(command "$python" -c "import pwd, os; print(pwd.getpwuid(os.geteuid()).pw_shell)") \
detect_python && output=$(command "$python" -c "import pwd, os; exec(\"try:print(pwd.getpwuid(os.geteuid()).pw_shell)\nexcept:print(os.environ.get('SHELL')or'/bin/sh')\")") \
&& login_shell="$output" && login_shell_is_ok
}