(p []byte)
| 180 | } |
| 181 | |
| 182 | func (c *commandConn) Write(p []byte) (int, error) { |
| 183 | n, err := c.stdin.Write(p) |
| 184 | // check after the call to Write, since |
| 185 | // it is blocking, and while waiting on it |
| 186 | // Close might get called |
| 187 | if c.closing.Load() { |
| 188 | // If we're currently closing the connection |
| 189 | // we don't want to call onEOF |
| 190 | return n, err |
| 191 | } |
| 192 | |
| 193 | return n, c.handleEOF(err) |
| 194 | } |
| 195 | |
| 196 | // CloseRead allows commandConn to implement halfCloser |
| 197 | func (c *commandConn) CloseRead() error { |