psutil.Process.exe() is not reporting the correct path to a process.
The situation is the following: There are multiple processes running in C:\test\my-program\tomcat\bin\tomcat.exe. Moreover, there are multiple versions of my-program (e.g. my-program1.0, my-program1.1, ...). Additionally, test is a mounted volume and provides the following information:
Directory of C:\
04/12/2022 07:04 PM <DIR> home
03/23/2022 01:50 PM <JUNCTION> test [\??\Volume{e4a9240d-9878-4c6c-8594-00fea2f7af11}\]
11/16/2022 02:02 PM <DIR> Program Files
04/12/2022 03:30 PM <DIR> Program Files (x86)
...
In my script, I am checking if processes of my-program are running. For that, I am interested in the PID and the location of the Process (psutil.Process.exe()). Gathering this information is done via psutil.process_iter(). The processes are listed correctly (PID). However, the problem is psutil.Process.exe().
When calling psutil.Process.exe() I would expect, that the returned path to the executable is C:\test\my-program1.0\tomcat\bin\tomcat.exe, which it is if test is not a mounted volume. However, if test is a mounted volume, it returns \my-program1.0\tomcat\bin\tomcat.exe. Meaning that the part C:\test is missing.
I guess this problem is somewhat related to #775, but might be slightly different.
Additional Info on the Mounted Volume
According to Windows, the drive is of Type Mounted Volume. However, the type switches to Local Disk if I look at the properties of the Volume. The File System inside the Volume is NTFS.
Summary
Description
psutil.Process.exe()
is not reporting the correct path to a process.The situation is the following: There are multiple processes running in
C:\test\my-program\tomcat\bin\tomcat.exe
. Moreover, there are multiple versions ofmy-program
(e.g.my-program1.0
,my-program1.1
, ...). Additionally,test
is a mounted volume and provides the following information:In my script, I am checking if processes of
my-program
are running. For that, I am interested in the PID and the location of the Process (psutil.Process.exe()
). Gathering this information is done viapsutil.process_iter()
. The processes are listed correctly (PID). However, the problem ispsutil.Process.exe()
.When calling
psutil.Process.exe()
I would expect, that the returned path to the executable isC:\test\my-program1.0\tomcat\bin\tomcat.exe
, which it is iftest
is not a mounted volume. However, iftest
is a mounted volume, it returns\my-program1.0\tomcat\bin\tomcat.exe
. Meaning that the partC:\test
is missing.I guess this problem is somewhat related to #775, but might be slightly different.
Additional Info on the Mounted Volume
According to Windows, the drive is of Type
Mounted Volume
. However, the type switches toLocal Disk
if I look at the properties of the Volume. The File System inside the Volume is NTFS.