Handle argv[0] being buggered on macOS

This commit is contained in:
Kovid Goyal 2022-04-15 12:25:05 +05:30
parent 4cf54d2dfb
commit 0fcfe104e3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

@ -283,8 +283,8 @@ class Child:
# xterm, urxvt, konsole and gnome-terminal do not do it in my
# testing.
argv[0] = (f'-{exe.split("/")[-1]}')
exe = which(exe) or exe
pid = fast_data_types.spawn(exe, self.cwd, tuple(argv), env, master, slave, stdin_read_fd, stdin_write_fd, ready_read_fd, ready_write_fd)
self.final_exe = which(exe) or exe
pid = fast_data_types.spawn(self.final_exe, self.cwd, tuple(argv), env, master, slave, stdin_read_fd, stdin_write_fd, ready_read_fd, ready_write_fd)
os.close(slave)
self.pid = pid
self.child_fd = master

View File

@ -547,6 +547,8 @@ def clone_and_launch(msg: str, window: Window) -> None:
cmdline = []
if not cmdline:
cmdline = list(window.child.argv)
if cmdline and cmdline[0] == window.child.argv[0]:
cmdline[0] = window.child.final_exe
ssh_kitten_cmdline = window.ssh_kitten_cmdline()
if ssh_kitten_cmdline:
from kittens.ssh.main import set_cwd_in_cmdline, set_env_in_cmdline