killOnContext waits for the context to be done and kills the process, unless it exits on its own first.
(ctx context.Context)
| 273 | |
| 274 | // killOnContext waits for the context to be done and kills the process, unless it exits on its own first. |
| 275 | func (p *windowsProcess) killOnContext(ctx context.Context) { |
| 276 | select { |
| 277 | case <-p.cmdDone: |
| 278 | return |
| 279 | case <-ctx.Done(): |
| 280 | p.Kill() |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | // winerrorFailed returns true if the syscall failed, this function |
| 285 | // assumes the return value is a 32-bit integer, like HRESULT. |