Use shell parser to correctly parse exec commands with quotes#445
Use shell parser to correctly parse exec commands with quotes#445mortymacs merged 1 commit intowait4x:mainfrom
Conversation
|
To the maintainers: I am on MacOS and having some trouble running the test suite. It builds and behaves correctly as far as I can tell, however I might need someone who has the environment set up to run the test suite. I am more than happy to fix any issues come up. Edit: I got my test setup working, the Testcontainer setup was looking at the default Docker socket, but I am using Colima so I had to change that and it worked |
8112212 to
324cb85
Compare
|
Hi @MatthewCane , Thanks for the PR! The only issue we have is that the library you're using is outdated (last commit was about 5 years ago), and we need something more current. If you don't mind, I'll update the PR. Cheers, |
|
You are right @mortymacs, it is pretty old. I did see a Google package that is even older, and a few others, but your knowledge of the Go ecosystem is probably a lot better than mine so you are more than welcome to update the PR with a better maintained library. |
324cb85 to
2ba9996
Compare
2ba9996 to
6aa4afc
Compare
6aa4afc to
8d5fb06
Compare
|
@mortymacs I have found a replacement library, https://github.com/mvdan/sh, that is well maintained and does what we need. Let me know if this is okay! |
|
@MatthewCane awesome! thanks you very much! I'm going to add a few tests and then we'll merge it soon 👍 |
Pull Request Test Coverage Report for Build 16446650440Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
I'm gonna merge the PR and I'll add tests in a separate PR. |
|
Thanks @MatthewCane ! |
This fixes #443.
Using the
shshell parser fixes the issue where quotes were not being properly split meaning commands likesh -c 'echo foo'would always fail. Previously it would be parsed as:["sh", "-c", "'echo", "foo'"]whereas it should be parsed as:
["sh", "-c", "'echo foo'"]This also means that pipes can be used correctly as pipes are not supported by the
os/execmodule without using a subshell, see: