Skip to content

Quote zero-length strings in arguments#1551

Merged
remy merged 1 commit into
remy:masterfrom
forivall:patch-1
May 1, 2019
Merged

Quote zero-length strings in arguments#1551
remy merged 1 commit into
remy:masterfrom
forivall:patch-1

Conversation

@forivall

Copy link
Copy Markdown
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

stale Bot commented Apr 24, 2019

Copy link
Copy Markdown

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

remy commented Apr 24, 2019

Copy link
Copy Markdown
Owner

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

forivall commented May 1, 2019

Copy link
Copy Markdown
Contributor Author

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