Error returns any error present on the pipe, or nil otherwise. Error is not a sink and does not wait until the pipe reaches completion. To wait for completion before returning the error, see [Pipe.Wait].
()
| 395 | // completion. To wait for completion before returning the error, |
| 396 | // see [Pipe.Wait]. |
| 397 | func (p *Pipe) Error() error { |
| 398 | if p.mu == nil { // uninitialised pipe |
| 399 | return nil |
| 400 | } |
| 401 | p.mu.Lock() |
| 402 | defer p.mu.Unlock() |
| 403 | return p.err |
| 404 | } |
| 405 | |
| 406 | // Exec runs cmdLine as an external command, sending it the contents of the |
| 407 | // pipe as input, and produces the command's standard output (see below for |
no outgoing calls