mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(activate): use exe instead of comm for parent shell detection
Currently, we are using psutil.Process().name(), which includes the command as entered on the command line. This becomes an issue if the export script is initiated within another script. run.sh #!/usr/bin/bash . ./export.sh In this case the activate script will see `run.sh` instead of bash. /proc/<pid>/com vs /proc/<pid>/exe Use exe(), which contains the full executable path to fix this. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
parent
f90b847cb1
commit
65d18fce4c
@ -107,7 +107,7 @@ def detect_shell(args: Any) -> str:
|
||||
detected_shell_name = ''
|
||||
while True:
|
||||
parent_pid = psutil.Process(current_pid).ppid()
|
||||
parent_name = psutil.Process(parent_pid).name()
|
||||
parent_name = os.path.basename(psutil.Process(parent_pid).exe())
|
||||
if not parent_name.lower().startswith('python'):
|
||||
detected_shell_name = parent_name
|
||||
conf.DETECTED_SHELL_PATH = psutil.Process(parent_pid).exe()
|
||||
|
Loading…
Reference in New Issue
Block a user