Merge pull request #563 from mlaventure/notty-detach-panic

Prevent a panic when container fails to start
This commit is contained in:
Alexander Morozov
2016-02-16 15:22:50 -08:00
+6 -2
View File
@@ -311,7 +311,9 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
defer handler.Close()
if err := container.Start(process); err != nil {
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
@@ -319,7 +321,9 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
if err := createPidFile(pidFile, process); err != nil {
process.Signal(syscall.SIGKILL)
process.Wait()
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
}