Skip to content

Commit

Permalink
Merge pull request containers#5474 from giuseppe/detect-containers-ro…
Browse files Browse the repository at this point in the history
…otlessport-child-exit

rootlessport: detect rootless-child exit
  • Loading branch information
openshift-merge-robot committed Mar 12, 2020
2 parents 235f367 + 647dc33 commit 9c7481d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/rootlessport/rootlessport_linux.go
Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 9c7481d

Please sign in to comment.