nodemon icon indicating copy to clipboard operation
nodemon copied to clipboard

[Bug, Discussion] Invalid parsing of the 'exec' parameter in Windows

Open TheDechev opened this issue 3 years ago • 5 comments

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:
  1. Set the exec parameter in the local configuration file (nodemon.json):
{
    "exec": "/C/Program Files/nodejs/node"
}
  1. 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 execArr parameter which'll allow setting an executable with arguments in an array. Downside - will be too similar to the execMap parameter.

  • Split exec parameter to execPath and execArgs. Downside - that would break API.

What do you guys think?

TheDechev avatar Feb 28 '22 21:02 TheDechev

ping

TheDechev avatar Mar 12 '22 11:03 TheDechev

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

github-actions[bot] avatar Jun 28 '22 10:06 github-actions[bot]

@remy, relevant or not interesting?

TheDechev avatar Jul 03 '22 07:07 TheDechev

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

github-actions[bot] avatar Jul 17 '22 09:07 github-actions[bot]

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'"

remy avatar Jul 17 '22 12:07 remy

Assume the above changed fixed the issue - happy to hear otherwise.

remy avatar Aug 16 '22 08:08 remy

You are completely right @remy, my bad, thanks!

TheDechev avatar Aug 17 '22 21:08 TheDechev