8000 Use shlex instead of strings.split for command by ghjm · Pull Request #517 · ansible/receptor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use shlex instead of strings.split for command #517

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

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

ghjm
Copy link
Contributor
@ghjm ghjm commented Jan 11, 2022

Currently, --command-service uses strings.Split() to split the provided command, and then executes the first component with the remaining components as parameters. This means that parameters cannot be grouped using quotes. For example, you cannot do things like:

- command-service:
        service: test
        command: sh -c "/my/noisy/script.sh 2> /dev/null"

This PR switches to using shlex.Split(), which splits the string into tokens using shell semantics, respecting quotes.

Copy link
Member
@rebeccahhh rebeccahhh left a comment

Choose a reason for hiding this comment

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

I like this, especially because it has error handling

@ghjm
Copy link
Contributor Author
ghjm commented Jan 11, 2022

@shanemcd @fosterseth merge me please

@fosterseth fosterseth merged commit cbf2e22 into ansible:devel Jan 11, 2022
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.

3 participants
0