[Bug, Discussion] Invalid parsing of the 'exec' parameter in Windows
Info
-
node -v: v17.3.0 -
nodemon -v: 2.0.15 - Operating system/terminal environment (powershell, gitshell, etc): Windows (shell not important)
- Using Docker? N/A
- Command you ran:
- Set the
execparameter in the local configuration file (nodemon.json):
{
"exec": "/C/Program Files/nodejs/node"
}
- Run any node application, e.g.:
nodemon app.j
Expected behaviour
The exec parameter should be parsed and converted to:
\C\Program Files\nodejs\node
Actual behaviour
- The exec parameter is parsed using
split(' ')(here) , thus it separates the path and converts it to:\C\Program Files/nodejs/node - The application crashes because it attempts to access an invalid path:
The system cannot find the path specified.
[nodemon] app crashed - waiting for file changes before starting...
Steps to reproduce
Create a configuration file (nodemon.json) and set the exec paramter to a path containing blank spaces. (just like the example above)
Summary
I have a few ideas, but both of them have some sort of a downside-
-
Introduce
execArrparameter which'll allow setting an executable with arguments in an array. Downside - will be too similar to theexecMapparameter. -
Split
execparameter toexecPathandexecArgs. Downside - that would break API.
What do you guys think?
ping
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
@remy, relevant or not interesting?
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
Just reading this, the arg doesn't look valid:
"exec": "/C/Program Files/nodejs/node"
Shouldn't it be:
"exec": "/C/Program\ Files/nodejs/node"
// or
"exec": "'/C/Program Files/nodejs/node'"
Assume the above changed fixed the issue - happy to hear otherwise.
You are completely right @remy, my bad, thanks!