Read reads up to len(b) bytes from the pipe into b. It returns the number of bytes read and any error encountered. At end of file, or on a nil pipe, Read returns 0, [io.EOF].
(b []byte)
| 853 | // bytes read and any error encountered. At end of file, or on a nil pipe, Read |
| 854 | // returns 0, [io.EOF]. |
| 855 | func (p *Pipe) Read(b []byte) (int, error) { |
| 856 | if p.Error() != nil { |
| 857 | return 0, p.Error() |
| 858 | } |
| 859 | return p.Reader.Read(b) |
| 860 | } |
| 861 | |
| 862 | // SetError sets the error err on the pipe. |
| 863 | func (p *Pipe) SetError(err error) { |