We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5cb9a2f commit 14bc89dCopy full SHA for 14bc89d
1 file changed
granulate_utils/linux/process.py
@@ -24,17 +24,12 @@
24
25
def process_exe(process: psutil.Process) -> str:
26
"""
27
- psutil.Process(pid).exe() returns "" for zombie processes, incorrectly. It should raise ZombieProcess, and return ""
28
- only for kernel threads.
29
-
30
- See https://github.com/giampaolo/psutil/pull/2062
+ psutil.Process(pid).exe() caches the result. This function returns the up-to-date exe in case the process exec-ed.
31
32
- # Clear the "exe" cache on the process object. It can change after being cached if the process execed.
+ # Clear the "exe" cache on the process object
33
process._exe = None # type: ignore
34
exe = process.exe()
35
if exe == "":
36
- if is_process_zombie(process):
37
- raise psutil.ZombieProcess(process.pid)
38
raise MissingExePath(process)
39
return exe
40
0 commit comments