MCPcopy
hub / github.com/bitfield/script / WithEnv

Method WithEnv

script.go:969–974  ·  view source on GitHub ↗

WithEnv sets the environment for subsequent [Pipe.Exec] and [Pipe.ExecForEach] commands to the string slice env, using the same format as [os/exec.Cmd.Env]. An empty slice unsets all existing environment variables.

(env []string)

Source from the content-addressed store, hash-verified

967// commands to the string slice env, using the same format as [os/exec.Cmd.Env].
968// An empty slice unsets all existing environment variables.
969func (p *Pipe) WithEnv(env []string) *Pipe {
970 p.mu.Lock()
971 defer p.mu.Unlock()
972 p.env = env
973 return p
974}
975
976// WithError sets the error err on the pipe.
977func (p *Pipe) WithError(err error) *Pipe {

Calls

no outgoing calls