MCPcopy Create free account
hub / github.com/ddev/ddev / WithEnv

Function WithEnv

pkg/exec/exec.go:32–42  ·  view source on GitHub ↗

WithEnv sets the environment variables for the host command

(env []string)

Source from the content-addressed store, hash-verified

30
31// WithEnv sets the environment variables for the host command
32func 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.

Callers 2

StopMutagenDaemonFunction · 0.92

Calls

no outgoing calls

Tested by 1