-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ensures windows extension less spawns run as .cmd #5
Conversation
I've refactored this pr to become: Given an absolute path on windows os @balupton I think I originally went a bit too far by defaulting to .cmd but now it attempts to discover the path and gives .cmd.bat priority over .exe if this is good then I will squash and change the version as it's not really a major change, it's more like a minor |
I've noticed that when determining paths that are absolute and have spaces in them causes an issue with the determineAbsoluteWindowsCommand because they are not enclosed in quotes. So I believe the fix for this is to ensure that all determined paths get enclosed in quotes before using them. i.e. "c:\program files (x86)\git\bin\git.exe". I will look in to this |
I wonder if there is a less intense way of accomplishing this? Right now Perhaps
With a flow something like this:
|
I've replaced the code and added a method called getExecExt which calls getPossibleExecPaths and determineExecPath to try to discover paths with possible extensions [.cmd, .bat, .exe] the flow is the following:
I've squashed all the commits to just one |
fixes the ext detection issue in getPossibleExecPaths
I found an issue in getPossibleExecPaths when trying to determine if there was an extension on windows. Sometimes paths have '.' in them yet no extention so just swapped the indexof check to become a path.extname check |
@pflannery did this get merged? why the close? |
@balupton i did a purge of all my very old PRs that never got attention and just presuming they weren't wanted\needed by me or the repo owner |
@pflannery ah k, yeah we may still want to merge this - just haven't got around to it with everything else that is going on |
Updated version with a major to 3.0.0
This merge defaults all extension less command lines to spawn using '.cmd' instead of the default '.exe'.
This gives windows users the ability to run commands like
npm init
and other npm package cmd's without having to write the extension just like linux and mac users enjoy using shebangs.It's a pain that every time we want to run a command in node on windows we have to fiddle the command line when it's not an .exe file. It just adds annoying complexity to our cross-os-compatible scripts.
By creating .cmd wrappers for exe's and placing them in a common path (i.e. %userprofile%\appdata\roaming\npm) they too can be run without specifying the ext. so this change seems the logical choice to me.
will fix chainyjs/chainy-cli/issues/4