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

Remove Windows edge case #60

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Remove Windows edge case #60

merged 1 commit into from
Sep 4, 2024

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Sep 3, 2024

On Windows, we need to know whether the binary is a .exe or .com file. If not, cmd.exe must be used.

To do that detection, we check for .exe or .com files within the current PATH environment variable, making a bunch of stat syscalls. If a file exists, we also make sure it is a regular file, not a directory.

So we check whether a file is a directory despite 1) having an executable name (like node), 2) ending with .exe/.com, 3) being in a directory referenced by PATH. This is quite an edge case that is very unlikely. This PR removes that to same some bytes and simplify the logic.

@sindresorhus sindresorhus merged commit 865d71e into main Sep 4, 2024
12 checks passed
@sindresorhus sindresorhus deleted the windows-edge-case branch September 4, 2024 03:57
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

Successfully merging this pull request may close these issues.

2 participants