Skip to content
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

Quote zero-length strings in arguments #1551

Merged
merged 1 commit into from
May 1, 2019
Merged

Conversation

forivall
Copy link
Contributor

If a zero-length string is passed, it does not get properly quoted, and then it is not properly passed to the child process

I noticed this issue when using nodemon to monitor a wrapper script, where i basically pass a bunch of arguments like function arguments.

TODO: update the commit message to fit your convention. I just did this quickly in the github editor.

If a zero-length string is passed, it does not get properly quoted, and then it is not properly passed to the child process
@stale
Copy link

stale bot commented Apr 24, 2019

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

@stale stale bot added the stale no activity for 2 weeks label Apr 24, 2019
@remy
Copy link
Owner

remy commented Apr 24, 2019

I'll fix this commit message on merge.

What was the case that caused this to be a bug (out of interest)?

@stale stale bot removed the stale no activity for 2 weeks label Apr 24, 2019
@remy remy merged commit 2973afb into remy:master May 1, 2019
@forivall
Copy link
Contributor Author

forivall commented May 1, 2019

I have a tool that uses nodemon to launch a wrapper around an api, where, to be lazy, I just use the position of arguments rather than any kind of arg parsing. I pass empty args to indicate that they're not set. The code looks like this:

  const args = [pkg, argv.entryFile || '', argv.api || '', argv.configFile || '']
  const nodemonConfig = {
    script: resolve('.runner-build/index.js'),
    args,
    stdout: true,
    delay: 0.5,
    ignore,
  }

  if (argv.runnerWatch) {
    nodemonConfig.watch = ['.', resolve('.runner-build')]
  }

  const n = nodemon(nodemonConfig)

Hope that makes sense!

remy added a commit that referenced this pull request May 25, 2019
* 'master' of github.com:remy/nodemon:
  chore: adding funding file
  chore: update stalebot
  feat: add message event
  fix: disable fork only if string starts with dash
  feat: add TypeScript to default execPath (#1552)
  fix: Quote zero-length strings in arguments (#1551)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants