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

[Enhancement]: setCommand should allow space escaping #9530

Open
ylemoigne opened this issue Nov 14, 2024 · 2 comments
Open

[Enhancement]: setCommand should allow space escaping #9530

ylemoigne opened this issue Nov 14, 2024 · 2 comments

Comments

@ylemoigne
Copy link

Module

Core

Proposal

Currently, GenericContainer.setCommand(String) do a command.split(" ").
This doesn't allow escaping the space. It can be an issue for command lines like postgres -c max_connections=100 -c default_transaction_isolation=repeatable read

The alternative method setCommand(String... commandParts) is not always available, for example, when using testcontainers through quarkus dev-service which doesn't expose a way to set command through array/list of parameters.

As command.split() take a regexp, changing the implementation to command.split("[^\\]? ") should allow user to write postgres -c max_connections=100 -c default_transaction_isolation=repeatable\ read and get correct interpretation.

@kiview
Copy link
Member

kiview commented Nov 28, 2024

Hi @ylemoigne, thanks for the suggestion.
Would you like to contribute this, if it can be done in a non-breaking manner?

@ylemoigne
Copy link
Author

Well, it is a breaking change. The goal is to change the behavior on the presence of an escape sequence, so any command containing the choosen escape sequence will not behave like before. We can only minimize the risk by choosing an escape sequence that have low chance of existing in current usage of the method.

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

No branches or pull requests

2 participants