I modified utils.py so that psutil does not raise a NameError in the case when psutil is not present. The original code of get_parent_process_name() would always raise an Exception in the past just from checking if psutil: if psutil was not successfully imported, and thus would always return the empty string "" without being able to fall back on executing the ps subprocess.
In addition, I used args= instead of cmd= in the ps command, because it is a synonym and is more universal. args= works on macOS (and presumably BSD) but cmd= does not.
I also removed a preceding - from the process name, in case the shell was called as a login shell.
Closes #30
I modified
utils.py
so thatpsutil
does not raise aNameError
in the case whenpsutil
is not present. The original code ofget_parent_process_name()
would always raise an Exception in the past just from checkingif psutil:
ifpsutil
was not successfully imported, and thus would always return the empty string""
without being able to fall back on executing theps
subprocess.In addition, I used
args=
instead ofcmd=
in theps
command, because it is a synonym and is more universal.args=
works on macOS (and presumably BSD) butcmd=
does not.I also removed a preceding
-
from the process name, in case the shell was called as a login shell.