Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix getRemainingFlags for arguments with multiple '--' in them #2175

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

sezanzeb
Copy link
Contributor

@sezanzeb sezanzeb commented Jul 14, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

nest start --exec "node --experimental-specifier-resolution=node --no-warnings" --debug fails with TypeError: Cannot read properties of undefined (reading 'toUpperCase'), because the camelCase function gets "de experimental-specifier-resolution=node --no-warnings" as input. splitting -- will result in an empty string, and ''[0] is undefined.

What is the new behavior?

It doesn't break.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Alternatives might be to skip all item values that don't start with '--' or that contain spaces or something. But I figured changing it to /--/g is the smallest change and has the least chance of breaking stuff that I'm not aware of.

To avoid this error, either remove --no-warnings or move --exec ... to the end.

Doesn't affect version 9.1.3, affects 9.5.0

@sezanzeb sezanzeb changed the title global-replace -- in string fix getRemainingFlags for arguments with multiple '--' in them Jul 14, 2023
@sezanzeb sezanzeb marked this pull request as ready for review July 14, 2023 09:45
@kamilmysliwiec kamilmysliwiec merged commit 36a7111 into nestjs:master Jul 17, 2023
@kamilmysliwiec
Copy link
Member

LGTM

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants