Skip to content

Commit e769391

Browse files
authored
Merge pull request #4310 from norio-nomura/let-usernet-cleanup-on-exit
pkg/networks/usernet: Use `SIGINT` instead of `SIGKILL`
2 parents 40e9649 + a392c0d commit e769391

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/networks/usernet/recoincile.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func Stop(ctx context.Context, name string) error {
143143
return err
144144
}
145145

146-
if err := osutil.SysKill(pid, osutil.SigKill); err != nil {
146+
if err := osutil.SysKill(pid, osutil.SigInt); err != nil {
147147
logrus.Error(err)
148148
return fmt.Errorf("failed to kill process with pid %d: %w", pid, err)
149149
}
@@ -157,7 +157,10 @@ func Stop(ctx context.Context, name string) error {
157157
break
158158
}
159159
if time.Since(startWaiting) > 5*time.Second {
160-
logrus.Infof("usernet network still running after 5 seconds")
160+
logrus.Infof("usernet network still running after 5 seconds. Attempting to forcibly kill")
161+
if err := osutil.SysKill(pid, osutil.SigKill); err != nil {
162+
logrus.Error(err)
163+
}
161164
break
162165
}
163166
time.Sleep(500 * time.Millisecond)

0 commit comments

Comments
 (0)