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

Fix(run): arguments are incorrectly gathered leading to duplicates #2999

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

justinwilaby
Copy link
Contributor

@justinwilaby justinwilaby commented Aug 29, 2024

This PR fixes and issue with the run command where arguments after the -- which collide with the command flag names are duplicated leading to errors.

e.g. heroku run -e DOMAIN=test -- ruby -e 'puts ENV["ENV_KEY"]' <-- '-e' is a collision with the command flag alias for env and is duplicated and sent to the Dyno by mistake.

NOTE: Reverting the sorted args is no longer needed since a direct slice from the process.argv is performed. This operation has been removed.

@justinwilaby justinwilaby requested a review from a team as a code owner August 29, 2024 23:09
@justinwilaby justinwilaby force-pushed the fix/run-args-processed-incorrectly branch from 3ee4796 to 5b837bf Compare August 29, 2024 23:12
@justinwilaby justinwilaby force-pushed the fix/run-args-processed-incorrectly branch from 5b837bf to 20b19a7 Compare August 29, 2024 23:35
Copy link
Contributor

@k80bowman k80bowman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still getting the original error with this fix:
image

This fix also reintroduces the bug we were trying to solve with the logic for re-sorting the args:
image

@justinwilaby justinwilaby force-pushed the fix/run-args-processed-incorrectly branch from 20b19a7 to b39a726 Compare August 30, 2024 13:59
Copy link
Contributor

@k80bowman k80bowman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commands are working now, thank you. 🎉

If we're not using the revertSortedArgs function any more, could you please remove it from the helpers file?

@justinwilaby justinwilaby force-pushed the fix/run-args-processed-incorrectly branch from b39a726 to fcd8a59 Compare August 30, 2024 14:23
Copy link
Contributor

@k80bowman k80bowman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Works great.

@justinwilaby justinwilaby merged commit 85f36c5 into main Aug 30, 2024
8 checks passed
@justinwilaby justinwilaby deleted the fix/run-args-processed-incorrectly branch August 30, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants