fix: use Signal(0) for process polling in daemonRunStop
Consistent with cmd/service stopDaemon — polls process directly instead of PID file removal to avoid PID reuse false positives. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
79e6587d8a
commit
48c3f08bcb
1 changed files with 3 additions and 1 deletions
|
|
@ -170,7 +170,9 @@ func daemonRunStop(cfg DaemonCommandConfig) error {
|
||||||
|
|
||||||
deadline := time.Now().Add(30 * time.Second)
|
deadline := time.Now().Add(30 * time.Second)
|
||||||
for time.Now().Before(deadline) {
|
for time.Now().Before(deadline) {
|
||||||
if _, still := process.ReadPID(cfg.PIDFile); !still {
|
if err := proc.Signal(syscall.Signal(0)); err != nil {
|
||||||
|
// Process is gone — clean up PID file if it lingers.
|
||||||
|
_ = os.Remove(cfg.PIDFile)
|
||||||
LogInfo("Daemon stopped")
|
LogInfo("Daemon stopped")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue