Merge pull request #5474 from giuseppe/detect-containers-rootlessport-child-exit
rootlessport: detect rootless-child exit
This commit is contained in:
commit
9c7481dbd1
|
|
@ -160,6 +160,13 @@ func parent() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
childErrCh := make(chan error)
|
||||||
|
go func() {
|
||||||
|
err := cmd.Wait()
|
||||||
|
childErrCh <- err
|
||||||
|
close(childErrCh)
|
||||||
|
}()
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := syscall.Kill(cmd.Process.Pid, syscall.SIGTERM); err != nil {
|
if err := syscall.Kill(cmd.Process.Pid, syscall.SIGTERM); err != nil {
|
||||||
logrus.WithError(err).Warn("kill child process")
|
logrus.WithError(err).Warn("kill child process")
|
||||||
|
|
@ -174,6 +181,10 @@ outer:
|
||||||
case <-initComplete:
|
case <-initComplete:
|
||||||
logrus.Infof("initComplete is closed; parent and child established the communication channel")
|
logrus.Infof("initComplete is closed; parent and child established the communication channel")
|
||||||
break outer
|
break outer
|
||||||
|
case err := <-childErrCh:
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
case err := <-errCh:
|
case err := <-errCh:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue