We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dfeda1f commit e335c57Copy full SHA for e335c57
1 file changed
granulate_utils/linux/process.py
@@ -35,17 +35,12 @@
35
36
def process_exe(process: psutil.Process) -> str:
37
"""
38
- psutil.Process(pid).exe() returns "" for zombie processes, incorrectly. It should raise ZombieProcess, and return ""
39
- only for kernel threads.
40
-
41
- 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.
42
43
- # 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
44
process._exe = None # type: ignore
45
exe = process.exe()
46
if exe == "":
47
- if is_process_zombie(process):
48
- raise psutil.ZombieProcess(process.pid)
49
raise MissingExePath(process)
50
return exe
51
0 commit comments