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

CLI parameters with spaces broken since v14.3.5 #506

Closed
3 of 5 tasks
gruntster opened this issue May 13, 2024 · 3 comments · Fixed by #511
Closed
3 of 5 tasks

CLI parameters with spaces broken since v14.3.5 #506

gruntster opened this issue May 13, 2024 · 3 comments · Fixed by #511
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@gruntster
Copy link

Software versions

  • OS: Ubuntu 24.04 LTS
  • Pact Node version: v12.5.0
  • Node Version: v20.13.0
  • Other Versions: pact-core v14.3.6

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code
  • I have set my log level to debug and attached a log file showing the complete request/response cycle
  • For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem

Expected behaviour

CLIs handle quoted parameters with spaces, e.g. "my pact.json", as a single parameter.

Actual behaviour

Since v14.3.5, CLIs now treat quoted parameters as individual parameters, e.g. "my pact.json" is treated as two parameters my pact.json.

Steps to reproduce

An easy way to reproduce the issue is to run a CLI from v14.3.5 or v14.3.6 using npx. e.g. npx --package=@pact-foundation/pact-core@14.3.5 -c 'pact-broker publish "my pact.json" --consumer-app-version 1'

The error output highlights that the filename (in bold) has been truncated at the space.

Specified pact file 'my' does not exist.

Compared to running the same command with v14.3.4. npx --package=@pact-foundation/pact-core@14.3.4 -c 'pact-broker publish "my pact.json" --consumer-app-version 1'

Specified pact file 'my pact.json' does not exist.

@gruntster gruntster added the bug Indicates an unexpected problem or unintended behavior label May 13, 2024
@YOU54F
Copy link
Member

YOU54F commented May 13, 2024

This may have been introduced by #504 as that was the only change between v14.3.4 and v14.3.5

See release note

https://github.com/pact-foundation/pact-js-core/releases/tag/v14.3.5

@YOU54F
Copy link
Member

YOU54F commented May 28, 2024

Thanks for the repro, I've tested out a fix

npx --package=@you54f/pact-core@15.0.1 -c 'pact-broker publish "my pact.json" --consumer-app-version=1'

it doesn't set shell unless its windows, and if shell value is set, it escapes arguments based on the detected shell

https://github.com/YOU54F/pact-js-core/pull/45/files

will get a pr raised against this repo shortly

@YOU54F
Copy link
Member

YOU54F commented May 29, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants