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

replace shell parsing w/ direct shell call #1496

Merged
merged 1 commit into from
Jul 30, 2021
Merged

Conversation

eikenb
Copy link
Contributor

@eikenb eikenb commented Jul 29, 2021

Instead of trying to parse the shell command line into arguments for input to exec.Command this replaces that all with passing it to an 'sh -c' call. This will "fix" the wack-o-mole game of spot fixing issues that keep coming up with the shell parsing package.

Windows is handled separately (no 'sh') and is setup to only accept/run a single command.

The code changes are pretty small, bulked out a bit by the need to handle windows separately. Most of the code here are tests I added to try to exercise different cases mentioned in previously submitted issues.

Fixes #1482

Instead of trying to parse the shell command line into arguments for
input to exec.Command this replaces that all with passing it to an 'sh
-c' call. This will "fix" the wack-o-mole game of spot fixing issues
that keep coming up with the shell parsing package.

Windows is handled separately (no 'sh') and is setup to only accept/run
a single command.
@eikenb eikenb added the bug label Jul 29, 2021
@eikenb eikenb added this to the 0.26.1 milestone Jul 29, 2021
@eikenb eikenb requested a review from a team July 29, 2021 20:56
Copy link
Contributor

@findkim findkim left a comment

Choose a reason for hiding this comment

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

Nice test cases 🙂

That makes sense about avoiding wack-a-mole from recreating shell parsing, and instead defer to the shell to handle the raw string args.

@eikenb eikenb merged commit 1b5a0a8 into master Jul 30, 2021
@eikenb eikenb deleted the no-more-shell-parsing branch July 30, 2021 23:24
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.

Consul Template 0.26.0 issues with command substitution
2 participants