mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-28 03:41:41 +00:00
Add comments document realpath behavior for cwd_of_process
This commit is contained in:
parent
575538c3f9
commit
c08fb91b29
1 changed files with 4 additions and 0 deletions
|
|
@ -30,6 +30,8 @@ if is_macos:
|
|||
from kitty.fast_data_types import process_group_map as _process_group_map
|
||||
|
||||
def cwd_of_process(pid: int) -> str:
|
||||
# The underlying code on macos returns a path with symlinks resolved
|
||||
# anyway but we use realpath for extra safety.
|
||||
return os.path.realpath(_cwd(pid))
|
||||
|
||||
def process_group_map() -> DefaultDict[int, list[int]]:
|
||||
|
|
@ -56,6 +58,8 @@ else:
|
|||
return os.path.realpath(ans)
|
||||
else:
|
||||
def cwd_of_process(pid: int) -> str:
|
||||
# We use realpath instead of readlink to match macOS behavior where
|
||||
# the underlying OS API returns real paths.
|
||||
ans = f'/proc/{pid}/cwd'
|
||||
return os.path.realpath(ans)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue