Exit signal forward if process not found
Previously the signal loop can end up racing with the process exiting. Intead of logging and continuing the loop, exit early. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
d4e78200d6
commit
6650510836
@ -23,6 +23,7 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -38,6 +39,10 @@ func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal {
|
||||
for s := range sigc {
|
||||
logrus.Debug("forwarding signal ", s)
|
||||
if err := task.Kill(ctx, s.(syscall.Signal)); err != nil {
|
||||
if errdefs.IsNotFound(err) {
|
||||
logrus.WithError(err).Debugf("Not forwarding signal %s", s)
|
||||
return
|
||||
}
|
||||
logrus.WithError(err).Errorf("forward signal %s", s)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user