Skip to content

Commit f073a42

Browse files
pbetkierOskar Jagodziński
authored andcommitted
Change KillTree to no longer send SIGCONT after SIGKILL (#135)
1 parent 71d2346 commit f073a42

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

os/kill.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ func getAllChildren(proc *process.Process) []*process.Process {
6262
// SIGCONT to prevent processes from forking during termination, so we will not
6363
// have orphaned processes after.
6464
func wrapWithStopAndCont(signal syscall.Signal, pgids []int) error {
65-
signals := []syscall.Signal{syscall.SIGSTOP, signal, syscall.SIGCONT}
65+
signals := []syscall.Signal{syscall.SIGSTOP, signal}
66+
if signal != syscall.SIGKILL { // no point in sending any signal after SIGKILL
67+
signals = append(signals, syscall.SIGCONT)
68+
}
69+
6670
for _, currentSignal := range signals {
6771
if err := sendSignalToProcessGroups(currentSignal, pgids); err != nil {
6872
return err

0 commit comments

Comments
 (0)