Fix forward_stdio not working on macOS

This commit is contained in:
Kovid Goyal
2024-09-29 12:17:30 +05:30
parent cea92583dd
commit 70e068e414
2 changed files with 6 additions and 2 deletions

View File

@@ -319,12 +319,14 @@ class Child:
if ksi == 'invalid':
ksi = 'enabled'
argv = [kitten_exe(), 'run-shell', '--shell', shlex.join(argv), '--shell-integration', ksi]
if is_macos:
if is_macos and not self.pass_fds and not opts.forward_stdio:
# In addition for getlogin() to work we need to run the shell
# via the /usr/bin/login wrapper, sigh.
# And login on macOS looks for .hushlogin in CWD instead of
# HOME, bloody idiotic so we cant cwd when running it.
# https://github.com/kovidgoyal/kitty/issues/6511
# login closes inherited file descriptors so dont use it when
# forward_stdio or pass_fds are used.
import pwd
user = pwd.getpwuid(os.geteuid()).pw_name
if cwd: