Skip to content

Commit

Permalink
fix: fix remove pid (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
wencaiwulue authored Feb 18, 2024
1 parent 1f32a12 commit c689f47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/daemon/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ func runDaemon(ctx context.Context, exe string, isSudo bool) error {
if pid, err = strconv.Atoi(strings.TrimSpace(string(file))); err == nil {
var p *os.Process
if p, err = os.FindProcess(pid); err == nil {
if err = p.Kill(); err != nil && err != os.ErrProcessDone {
if err = p.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) {
log.Error("kill process", "err", err)
}
_, _ = p.Wait()
}
}
err = os.Remove(pidPath)
if err != nil {
if err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
}
Expand Down

0 comments on commit c689f47

Please sign in to comment.