(p []byte)
| 289 | } |
| 290 | |
| 291 | func (s *StdinCloser) Read(p []byte) (int, error) { |
| 292 | s.mu.Lock() |
| 293 | defer s.mu.Unlock() |
| 294 | if s.closed { |
| 295 | return 0, syscall.EBADF |
| 296 | } |
| 297 | n, err := s.Stdin.Read(p) |
| 298 | if err != nil { |
| 299 | if s.Closer != nil { |
| 300 | s.Closer() |
| 301 | s.closed = true |
| 302 | } |
| 303 | } |
| 304 | return n, err |
| 305 | } |
| 306 | |
| 307 | // Close implements Closer |
| 308 | func (s *StdinCloser) Close() error { |