nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.51k stars 2.34k forks source link

run-command passthrough parameters might be rendered incorrectly when invoking the command #7064

Closed lcabral37 closed 2 years ago

lcabral37 commented 3 years ago

Current Behavior

When passing some complex parameters to a command, dot notation parameters and parameters containing spaces do not get properly invoked to the final command. For example , assuming the nx app-e2e:e2e target command is wdio run wdio.conf.js the following command

nx run app-e2e:e2e --cucumberOpts.timeout=3000 --tags="not @exclude" would render the final command as wdio run wdio.conf.js --cucumberOpts=[Object] --tags=not @exclude

Note that the --cucumberOpts.timeout is no longer present instead having a --cucumberOpts=[Object] and also the --tags now only contains not (this would also lead to other potential issues when the string contained special characters (parenthesis or quotes))

Therefore the final targeted command would not received the same parameters as given originally. These parameters would in fact also be incorrectly invoked in the nx process forks

Expected Behavior

When passing parameters to run-command targets, theses parameters should remain untouched So I would expect the targeted command to be called with

wdio run wdio.conf.js --cucumberOpts.timeout=3000 --tags="not @exclude"

Steps to Reproduce

The current issue should be easy to expose by creating a simple project

{
  "projectType": "application",
  "root": "apps/args-example",
  "sourceRoot": "apps/args-example",
  "targets": {
    "test": {
      "executor": "@nrwl/workspace:run-commands",
      "options": {
        "parallel": false,
        "commands": [  "node -e 'console.log(process.argv)'; " ]
      },
      "outputs": []
    }
  }
}

And then triggering that command with some complex parameters and see that the output does not match.

$ nx test args-example  --dot.notation=1 --stringParams="String with spaces"

Failure Logs

Environment

nx report

>  NX  Report complete - copy this into the issue template

  Node : 14.16.0
  OS   : linux x64
  npm  : 6.14.11

  nx : Not Found
  @nrwl/angular : 12.5.8
  @nrwl/cli : 12.5.8
  @nrwl/cypress : 12.5.8
  @nrwl/devkit : 12.5.5
  @nrwl/eslint-plugin-nx : 12.5.8
  @nrwl/express : Not Found
  @nrwl/jest : 12.5.8
  @nrwl/linter : 12.5.8
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/nx-cloud : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.5.5
  @nrwl/web : Not Found
  @nrwl/workspace : 12.5.8
  @nrwl/storybook : 12.5.8
  @nrwl/gatsby : Not Found
  typescript : 4.2.4
github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.