This was copied and pasted more than a handful of times around the library and tests. Some implementations were more naive and did not try to add quotes if there are spaces within a single argument. There is one slight oddity in one of the cli parse tests. Stringifying the command causes many of the arguments to show up in quotes when they probably shouldn't. This seems to trace back to a deep problem related to how commands are pulled out of package.scripts.start and is out of scope for this patch. Even though the test might look incorrect now, it is an accurate reflection of what the generated command is.
Previously, the --nodejs flag was being prepended if you had any arguments prefixed with '--', even if they were intended for your application. There is an additional problem where arguments intended for node js need to be grouped into a single argument passed after --nodejs. After this patch, any flag before your script is considered a nodejs argument. These, along with any other exec arguments are bundled into a single argument separated by spaces. Fixes #530
If you try to run nodemon with a coffee file script and pass an argument to your application, it is instead adding a --nodejs when there are no node flags to pass along. This causes the command to fail because the script name is now passed as a flag to node. Repro: nodemon script.coffee --my-argument Expected: coffee script.coffee --my-argument Actual: coffee --nodejs script.coffee --my-argument Related to #530