(ctx context.Context, pid int)
| 55 | } |
| 56 | |
| 57 | func (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 | |
| 87 | func removeStaleSocket(path string) error { |
| 88 | cleanPath := strings.TrimSpace(path) |
no test coverage detected