summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-12 10:22:34 -0400
committerGitHub <noreply@github.com>2020-03-12 10:22:34 -0400
commit9c7481dbd1e6ea7e20ee03c85d4710c42ba81c6e (patch)
treefa5ca8f79e9e12bb9941bc2115726d3583f3bf81
parent235f367861be6b7f9ca3b4a62c240a03728a7a21 (diff)
parent647dc33e1ad967ade50d803816366a2a944691de (diff)
downloadpodman-9c7481dbd1e6ea7e20ee03c85d4710c42ba81c6e.tar.gz
podman-9c7481dbd1e6ea7e20ee03c85d4710c42ba81c6e.tar.bz2
podman-9c7481dbd1e6ea7e20ee03c85d4710c42ba81c6e.zip
Merge pull request #5474 from giuseppe/detect-containers-rootlessport-child-exit
rootlessport: detect rootless-child exit
-rw-r--r--pkg/rootlessport/rootlessport_linux.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go
index 2b51f4e09..febfc2268 100644
--- a/pkg/rootlessport/rootlessport_linux.go
+++ b/pkg/rootlessport/rootlessport_linux.go
@@ -160,6 +160,13 @@ func parent() error {
return err
}
+ childErrCh := make(chan error)
+ go func() {
+ err := cmd.Wait()
+ childErrCh <- err
+ close(childErrCh)
+ }()
+
defer func() {
if err := syscall.Kill(cmd.Process.Pid, syscall.SIGTERM); err != nil {
logrus.WithError(err).Warn("kill child process")
@@ -174,6 +181,10 @@ outer:
case <-initComplete:
logrus.Infof("initComplete is closed; parent and child established the communication channel")
break outer
+ case err := <-childErrCh:
+ if err != nil {
+ return err
+ }
case err := <-errCh:
if err != nil {
return err