diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-05-01 16:20:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 16:20:41 +0200 |
commit | ad68036a88e35dc3c7a19962b8e21867b459f8f1 (patch) | |
tree | b3854bdbf0971e58b85bdd039ea447ef6390d933 /pkg/adapter/sigproxy_linux.go | |
parent | eea77b5ae3e7fb8a60d438a79d3a4b30d35bb67c (diff) | |
parent | 0b6bb6a3d3c3c15b9c6629a6949a616a30b0478a (diff) | |
download | podman-ad68036a88e35dc3c7a19962b8e21867b459f8f1.tar.gz podman-ad68036a88e35dc3c7a19962b8e21867b459f8f1.tar.bz2 podman-ad68036a88e35dc3c7a19962b8e21867b459f8f1.zip |
Merge pull request #3031 from baude/remotewindows
enable podman-remote on windows
Diffstat (limited to 'pkg/adapter/sigproxy_linux.go')
-rw-r--r-- | pkg/adapter/sigproxy_linux.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/adapter/sigproxy_linux.go b/pkg/adapter/sigproxy_linux.go new file mode 100644 index 000000000..af968cb89 --- /dev/null +++ b/pkg/adapter/sigproxy_linux.go @@ -0,0 +1,36 @@ +package adapter + +import ( + "os" + "syscall" + + "github.com/containers/libpod/libpod" + "github.com/docker/docker/pkg/signal" + "github.com/sirupsen/logrus" +) + +// ProxySignals ... +func ProxySignals(ctr *libpod.Container) { + sigBuffer := make(chan os.Signal, 128) + signal.CatchAll(sigBuffer) + + logrus.Debugf("Enabling signal proxying") + + go func() { + for s := range sigBuffer { + // Ignore SIGCHLD and SIGPIPE - these are mostly likely + // intended for the podman command itself. + if s == signal.SIGCHLD || s == signal.SIGPIPE { + continue + } + + if err := ctr.Kill(uint(s.(syscall.Signal))); err != nil { + logrus.Errorf("Error forwarding signal %d to container %s: %v", s, ctr.ID(), err) + signal.StopCatch(sigBuffer) + syscall.Kill(syscall.Getpid(), s.(syscall.Signal)) + } + } + }() + + return +} |