WithEnv sets the environment variables for the host command
(env []string)
| 30 | |
| 31 | // WithEnv sets the environment variables for the host command |
| 32 | func WithEnv(env []string) CmdOption { |
| 33 | return func(cmd *exec.Cmd) { |
| 34 | if globalconfig.DdevVerbose { |
| 35 | output.UserOut.Printf("WithEnv: setting env vars %v", env) |
| 36 | } |
| 37 | if cmd.Env == nil { |
| 38 | cmd.Env = os.Environ() |
| 39 | } |
| 40 | cmd.Env = append(cmd.Env, env...) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // HostCommand wraps RunCommand() to inject environment variables. |
| 45 | // especially DDEV_EXECUTABLE, the full path to running DDEV instance. |
no outgoing calls