[Bug, Discussion] Invalid parsing of the 'exec' parameter in Windows
See original GitHub issueInfo
node -v: v17.3.0nodemon -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?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
JDK-4365120 Runtime.exec(String) does not parse ... - Bug ID
JDK-4365120 : Runtime.exec(String) does not parse quotes correctly. Type: Bug; Component: core-libs; Sub-Component: java.lang; Affected Version: 1.2.2,1.3.0.
Read more >Unable to create database (Oracle 12c R1 12.1.0.1.0 ...
I am installing Oracle 12c R1 on Windows 2012. ... O/S-Error: (OS 87) The parameter is incorrect". ... Parsing command line arguments:.
Read more >Error parsing the command-line arguments - TeraByte Unlimited
You can proves this by just setting up a run parameter exec testit.exe "testing\" /123. You'll see it's: testing\ /123
Read more >Solve Problems with External Command Lines in PowerShell
Windows PowerShell exacerbates the problem of command-line argument parsing because Windows PowerShell has its own syntax parser that must ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just reading this, the arg doesn’t look valid:
Shouldn’t it be:
You are completely right @remy, my bad, thanks!