fix(exec): only pass script args to script #11957
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Let's say you run this command:
yarn rw exec normalScript positional1 --no-prisma positional2 --arg1=foo --arg2 bar -s
What Redwood will do is run your scrip named
normalScript
. It will also pass it the two positional arguments'positional1'
and'positional2'
. Plus the two named argumentsarg1
andarg2
with the values'foo'
and'bar'
respectively. It will also read--no-prisma
and skip generating a prisma client, and-s
to run the script in silent mode.What it would also do however is pass a bunch of extra stuff to the script, including the
'exec'
word. This PR cleans all that up to only pass the actual script arguments to the script.This is breaking because people might have been counting on those extra arguments to be passed to the script. Especially
'exec'
because it gets passed to the script as part of the_
array. It was the first element, and (in this example)'positional1'
and'positional2'
would have come after it. So if people were expecting their first positional argument to be atargs._[1]
their script will now break.