Open JoseRaffucci opened 1 month ago
Pinging @blink1073, since he might know more information about this mechanism
I agree with @JoseRaffucci that we could skip this check and defer to the behavior of subprocess.Popen.
Understood, I'll update the project code and create a pull request for this issue.
I am running into an issue where if I provide a command that has a full path for an executable, for example: "C:\Program Files\Java\jdk-21\bin\java.exe"
It fails to load giving a FileNotFoundError. After investigating the spawn code I found it tries to find the executable in the PATH env variable. While testing the issue, I modified the environment variable PATH to include the location of the executable but this still failed.
To resolve the issue I commented out lines 79-87 of ptyprocess.py:
I am not sure the spawn code should be testing paths against the environment variable PATH and should be left to the code that is calling spawn. This gives more flexibility and also behaves more closely to the subprocess.Popen would. After commenting out this code everything was working as expected.
Another option to the environment PATH testing is if the "which" call returns None, perhaps a call to os.path.exists(command) or os.path.isfile(command) to verify the file exists.
Depending on how you would like the spawn function to behave, I would be glad to create a pull request.