Skip to content

Commit

Permalink
don't send kill to terminated process
Browse files Browse the repository at this point in the history
  • Loading branch information
makiuchi-d committed Feb 25, 2023
1 parent f87683d commit 7efbb43
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions arelo.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,19 +423,18 @@ func runCmd(ctx context.Context, cmd []string, sig syscall.Signal, stdin *stdinR
}
return cerr
case <-ctx.Done():
}

if err := killChilds(c, sig); err != nil {
return xerrors.Errorf("kill childs: %w", err)
if err := killChilds(c, sig); err != nil {
return xerrors.Errorf("kill childs: %w", err)
}
}

select {
case <-done:
case <-time.NewTimer(waitForTerm).C:
if err := killChilds(c, syscall.SIGKILL); err != nil {
return xerrors.Errorf("kill childs (SIGKILL): %w", err)
}
<-done
case <-done:
}

if cerr != nil {
Expand Down

0 comments on commit 7efbb43

Please sign in to comment.