fitzgen / is_executable

Is there an executable file at the given path?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check for extensions defined in PATHEXT on Windows

martonlanga opened this issue · comments

commented

I could probably write a PR for this, given the example code seems pretty clear.

@martonlanga what's the use case for this though over what the library already provides? Are there some cases where PATHEXT will determine a file executable where this crate wouldn't, or is this just an alternative implementation?

@alpha-tango-kilo I've replaced is_executable in my project with nushell's sample because the current version of this crate doesn't recognize certain executables as such.

Usually it's an external command that gets ignored (eg.: yarn.cmd).

commented

Okay, so does that make it a complete replacement for the current implementation or should it complement it?

I would imagine a file with its extension removed would be classified as runnable by this crate but not when tested using PATHEXT, are you able to confirm this?

I'm fine with a complete replacement, but you should ask @fitzgen about this.

Not entirely sure what you mean by this. Currently this crate only checks whether the provided path is executable or not. On Windows, I would expect this library to also check against the path joined with all the extensions defined in PATHEXT.

So if PATH_TO_YARN\yarn is not a valid path, it should check whether PATH_TO_YARN\yarn.exe, PATH_TO_YARN\yarn.cmd, ... is a valid path.