mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Fix forward_stdio not working on macOS
This commit is contained in:
@@ -319,12 +319,14 @@ class Child:
|
|||||||
if ksi == 'invalid':
|
if ksi == 'invalid':
|
||||||
ksi = 'enabled'
|
ksi = 'enabled'
|
||||||
argv = [kitten_exe(), 'run-shell', '--shell', shlex.join(argv), '--shell-integration', ksi]
|
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
|
# In addition for getlogin() to work we need to run the shell
|
||||||
# via the /usr/bin/login wrapper, sigh.
|
# via the /usr/bin/login wrapper, sigh.
|
||||||
# And login on macOS looks for .hushlogin in CWD instead of
|
# And login on macOS looks for .hushlogin in CWD instead of
|
||||||
# HOME, bloody idiotic so we cant cwd when running it.
|
# HOME, bloody idiotic so we cant cwd when running it.
|
||||||
# https://github.com/kovidgoyal/kitty/issues/6511
|
# 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
|
import pwd
|
||||||
user = pwd.getpwuid(os.geteuid()).pw_name
|
user = pwd.getpwuid(os.geteuid()).pw_name
|
||||||
if cwd:
|
if cwd:
|
||||||
|
|||||||
@@ -3316,7 +3316,9 @@ This is useful for debugging as it
|
|||||||
allows child processes to print to kitty's STDOUT directly. For example,
|
allows child processes to print to kitty's STDOUT directly. For example,
|
||||||
:code:`echo hello world >&$KITTY_STDIO_FORWARDED` in a shell will print
|
:code:`echo hello world >&$KITTY_STDIO_FORWARDED` in a shell will print
|
||||||
to the parent kitty's STDOUT. Sets the :code:`KITTY_STDIO_FORWARDED=fdnum`
|
to the parent kitty's STDOUT. Sets the :code:`KITTY_STDIO_FORWARDED=fdnum`
|
||||||
environment variable so child processes know about the forwarding.
|
environment variable so child processes know about the forwarding. Note that
|
||||||
|
on macOS this prevents the shell from being run via the login utility so getlogin()
|
||||||
|
will not work in programs run in this session.
|
||||||
''')
|
''')
|
||||||
|
|
||||||
opt('+menu_map', '',
|
opt('+menu_map', '',
|
||||||
|
|||||||
Reference in New Issue
Block a user