MCPcopy Create free account
hub / github.com/compozy/agh / waitForProcessExit

Method waitForProcessExit

internal/daemon/orphan.go:57–85  ·  view source on GitHub ↗
(ctx context.Context, pid int)

Source from the content-addressed store, hash-verified

55}
56
57func (d *Daemon) waitForProcessExit(ctx context.Context, pid int) bool {
58 if pid <= 0 {
59 return true
60 }
61 if !d.processAlive(pid) {
62 return true
63 }
64 if d.orphanGraceWait <= 0 || d.orphanPollWait <= 0 {
65 return !d.processAlive(pid)
66 }
67
68 timer := time.NewTimer(d.orphanGraceWait)
69 ticker := time.NewTicker(d.orphanPollWait)
70 defer timer.Stop()
71 defer ticker.Stop()
72
73 for {
74 select {
75 case <-ctx.Done():
76 return !d.processAlive(pid)
77 case <-ticker.C:
78 if !d.processAlive(pid) {
79 return true
80 }
81 case <-timer.C:
82 return !d.processAlive(pid)
83 }
84 }
85}
86
87func removeStaleSocket(path string) error {
88 cleanPath := strings.TrimSpace(path)

Callers 1

cleanupOrphansMethod · 0.95

Calls 3

processAliveMethod · 0.80
StopMethod · 0.65
DoneMethod · 0.65

Tested by

no test coverage detected