wrapDockerExec is a helper function that wraps the given command and arguments with a docker exec command that runs as the given user in the given container. This is used to fetch information about a container prior to running the actual command.
(containerName, userName, cmd string, args ...string)
| 205 | // container. This is used to fetch information about a container prior to |
| 206 | // running the actual command. |
| 207 | func wrapDockerExec(containerName, userName, cmd string, args ...string) (string, []string) { |
| 208 | dockerArgs := []string{"exec", "--interactive"} |
| 209 | if userName != "" { |
| 210 | dockerArgs = append(dockerArgs, "--user", userName) |
| 211 | } |
| 212 | dockerArgs = append(dockerArgs, containerName, cmd) |
| 213 | return "docker", append(dockerArgs, args...) |
| 214 | } |
| 215 | |
| 216 | // Helper function to run a command and return its stdout and stderr. |
| 217 | // We want to differentiate stdout and stderr instead of using CombinedOutput. |
no outgoing calls