diff --git a/cmd/ctr/commands/signals.go b/cmd/ctr/commands/signals.go index d0c1daa9b..311608c26 100644 --- a/cmd/ctr/commands/signals.go +++ b/cmd/ctr/commands/signals.go @@ -37,6 +37,10 @@ func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal { signal.Notify(sigc) go func() { for s := range sigc { + if canIgnoreSignal(s) { + logrus.Debugf("Ignoring signal %s", s) + continue + } logrus.Debug("forwarding signal ", s) if err := task.Kill(ctx, s.(syscall.Signal)); err != nil { if errdefs.IsNotFound(err) { diff --git a/cmd/ctr/commands/signals_linux.go b/cmd/ctr/commands/signals_linux.go new file mode 100644 index 000000000..f41abfcfd --- /dev/null +++ b/cmd/ctr/commands/signals_linux.go @@ -0,0 +1,27 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package commands + +import ( + "os" + + "golang.org/x/sys/unix" +) + +func canIgnoreSignal(s os.Signal) bool { + return s == unix.SIGURG +} diff --git a/cmd/ctr/commands/signals_notlinux.go b/cmd/ctr/commands/signals_notlinux.go new file mode 100644 index 000000000..6a9dccbc4 --- /dev/null +++ b/cmd/ctr/commands/signals_notlinux.go @@ -0,0 +1,25 @@ +//+build !linux + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package commands + +import "os" + +func canIgnoreSignal(_ os.Signal) bool { + return false +}