Wait reads the pipe to completion and returns any error present on the pipe, or nil otherwise. This is mostly useful for waiting until concurrent filters have completed (see [Pipe.Filter]).
()
| 956 | // the pipe, or nil otherwise. This is mostly useful for waiting until |
| 957 | // concurrent filters have completed (see [Pipe.Filter]). |
| 958 | func (p *Pipe) Wait() error { |
| 959 | _, err := io.Copy(io.Discard, p) |
| 960 | if err != nil { |
| 961 | p.SetError(err) |
| 962 | } |
| 963 | return p.Error() |
| 964 | } |
| 965 | |
| 966 | // WithEnv sets the environment for subsequent [Pipe.Exec] and [Pipe.ExecForEach] |
| 967 | // commands to the string slice env, using the same format as [os/exec.Cmd.Env]. |