Use absolute path when serializing foreground process

This commit is contained in:
Kovid Goyal
2025-08-16 17:33:00 +05:30
parent f91a0f6986
commit d04bb12a09
4 changed files with 27 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ if TYPE_CHECKING:
if is_macos:
from kitty.fast_data_types import abspath_of_process as _abspath_of_process
from kitty.fast_data_types import cmdline_of_process as cmdline_
from kitty.fast_data_types import cwd_of_process as _cwd
from kitty.fast_data_types import environ_of_process as _environ_of_process
@@ -30,6 +31,9 @@ if is_macos:
# anyway but we use realpath for extra safety.
return os.path.realpath(_cwd(pid))
def abspath_of_exe(pid: int) -> str:
return os.path.realpath(_abspath_of_process(pid))
def process_group_map() -> DefaultDict[int, list[int]]:
ans: DefaultDict[int, list[int]] = defaultdict(list)
for pid, pgid in _process_group_map():
@@ -82,6 +86,9 @@ else:
ans[q].append(pid)
return ans
def abspath_of_exe(pid: int) -> str:
return os.path.realpath(f'/proc/{pid}/exe')
@run_once
def checked_terminfo_dir() -> str | None: