Skip to content

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

Merged
kamilmysliwiec merged 1 commit intonestjs:masterfrom
sezanzeb:patch-1
Jul 17, 2023
Merged

fix getRemainingFlags for arguments with multiple '--' in them#2175
kamilmysliwiec merged 1 commit intonestjs:masterfrom
sezanzeb:patch-1

Conversation

@sezanzeb
Copy link
Copy Markdown
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
Copy Markdown
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants