diff options
| author | Claudomator Agent <agent@claudomator> | 2026-03-09 07:28:02 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator> | 2026-03-09 07:28:13 +0000 |
| commit | 3b4c50ead2885e9caef85193b68c12ccdb671ef1 (patch) | |
| tree | c365e615721c352c04afc6c66eff775517e40d45 /test | |
| parent | b4371d0a7dd625730c9d1e1b4010de5a7065e903 (diff) | |
executor: document kill-goroutine safety and add goroutine-leak test
The pgid-kill goroutine in execOnce() uses a select with both ctx.Done()
and the killDone channel. Add a detailed comment explaining why the goroutine
cannot block indefinitely: the killDone arm fires unconditionally when
cmd.Wait() returns (whether the process exited naturally or was killed),
so the goroutine always exits before execOnce() returns.
Add TestExecOnce_NoGoroutineLeak_OnNaturalExit to verify this: it samples
runtime.NumGoroutine() before and after execOnce() with a no-op binary
("true") and a background context (never cancelled), asserting no net
goroutine growth.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions
