bolt
bolt copied to clipboard
run_command: support an array of commands
!feature
-
*run_command: support an array of commands (#3333)
Added run_commands method which allows an array of commands to be passed to run_command
This does not address the use case described in the issue. The request is to mirror the pattern in puppet's exec to be more explicit about parameterization. The example they give is:
command => ['/bin/echo', 'hello world; rm -rf /']. Your PR here would do:/bin/echo && hello world; rm -rf /which is absolutely not what we want.Properly implementing this feature will involve making a similar change to how we use the underlying Open3 lib to take advantage of the explicit parameterization features.
Wondering if it would be acceptable splitting commands, then escaping each argument and then lastly joining arguments again into a single command? This way in [‘/bin/echo', 'hello world; rm -rf /'] the second command won’t run at all
My latest commit reflects those changes
I think you are misunderstanding the feature request. it is not to be able to run multiple commands in the same invocation of the function. Instead it is to support explicit parameters to a single command.