SetProcessDone sets a channel that will be closed when the process exits, and stores the error pointer that should be returned to pending/future requests. The error is read directly from the pointer after the channel closes, avoiding a race between an async goroutine and callers checking the error.
(done chan struct{}, errPtr *error)
| 99 | // The error is read directly from the pointer after the channel closes, avoiding |
| 100 | // a race between an async goroutine and callers checking the error. |
| 101 | func (c *Client) SetProcessDone(done chan struct{}, errPtr *error) { |
| 102 | c.processDone = done |
| 103 | c.processErrorMu.Lock() |
| 104 | c.processErrorPtr = errPtr |
| 105 | c.processErrorMu.Unlock() |
| 106 | } |
| 107 | |
| 108 | // getProcessError returns the process exit error if the process has exited. |
| 109 | // It reads directly from the stored error pointer, which is guaranteed to be |
no outgoing calls