Heya, is there a way to exec a command without turning it into an array? I'm getting bash commands from somewhere else and they could be strings like git clone git@github.com:dagger/dagger.git (though with this example I'd ofc know how to split the string into an array)? If I pass it as a whole into Container.withExec I get an error
#Exec without array
1 messages · Page 1 of 1 (latest)
👋 easiest way would be to do something like []string{"sh", "-c", "git clone ..."} - if you can trust that there's a shell in the container. This is how Dockerfiles work under the hood
If you can't be sure that it has sh, you'll want to use a shell syntax aware parser to split the arguments first, like https://github.com/google/shlex