bolt icon indicating copy to clipboard operation
bolt copied to clipboard

run_command: support an array of commands

Open alex501212 opened this issue 1 year ago • 3 comments

!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

alex501212 avatar Jul 22 '24 13:07 alex501212

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 22 '24 13:07 CLAassistant

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

alex501212 avatar Jul 26 '24 10:07 alex501212

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.

donoghuc avatar Jul 26 '24 16:07 donoghuc