Skip to content
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

(Not) recognizing absolute path to command #23

Closed
fwunderl opened this issue Feb 15, 2019 · 1 comment
Closed

(Not) recognizing absolute path to command #23

fwunderl opened this issue Feb 15, 2019 · 1 comment

Comments

@fwunderl
Copy link

Hi, first of all: Thanks for your work!
I noticed the following inconsistencies between Windows and Mac/Linux:

On Mac/Linux an absolute path to an executable file returns true
e.g. /usr/bin/ssh -> true

On Windows an absolute path is not accepted:
e.g. c:\Program Files\putty\plink.exe -> false

While this just seems to be an inconsistency, the following is certainly a bug:

On Mac/Linux all directories are recognized as "existing commands":
e.g. /usr -> true

@Antyos
Copy link
Contributor

Antyos commented Mar 28, 2020

I know this was last posted on over a year ago--No clue if you ever figured this out or not.

I have run into the same issue in a project of mine. After digging a bit into the code, it seems the error is because the commandExistsWindows() functions include a RegEx pattern to check for valid file names before testing if the command exists or not. This check will return false if the path given includes a :, which is normally not allowed in a Windows path, but is required for an absolute path, e.g. C:\Program Files\....

I found a better RegEx pattern for matching paths and will try to issue a pull request later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants