-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
windows: Do not check if the extension is executable #56
Comments
There is one question: does |
|
Is searching "xxx.py.EXE" a good behavior if "py" is not in |
Probably. The We should probably revert #57. |
Well, wait, my |
Okay, so if it's not inside |
Does it mean we should trade every file with extension as executable file on Windows? |
A good question! At this rate I'm not even sure what "executable" means on Windows anymore. If you double click and open a word doc you wouldn't say it's "executing" but a python script you double clicked on is definitely executing. For most files it'd be weird to open them and be like "here's your executable!" but a python script can definitely be executed by opening it. I don't know. It feels weird to carve out an exception just for python files, as there are other script interpreters that might have a similar setup. The question is actually kind of complicated and I think there's strong justification for both approaches. |
Personally, I'm not familiar with Windows.We need have a definition of executable for windows. |
FWIW the Windows equivalent to
|
Aligning with We could not to make a decision very soon. Let others leave their opinions. |
Closed in #83 |
The current implementation for windows checks all executable extensions in the environment variable
PATHEXT
, but if the binary path already has an extension that extension is currently ignored if it is not in that environment variable.which-rs/src/finder.rs
Line 182 in cd6add3
I'd argue this check is detrimental as it prevents some executable files (
.py
files in my case) to be found. These files may not be executable directly but through a shell.Now I really don't know what use cases this check has, but I'd nonetheless suggest replacing it with the following:
so forward the file if it has an extension, otherwise try all extensions in
PATHEXT
appended to file.An alternative would be, if the extension is not in
PATH_EXTENSIONS
and file does actually have an extension, add it to the beginning of the iterator with all executable extensions:Finally, another alternative is, and this would require more effort, to make this behavior configurable.
The text was updated successfully, but these errors were encountered: