Prevent a panic when container fails to start
This occurs when the container was requested to be started in detached mode and without a tty. Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
533ee4d688
commit
b011f80451
8
utils.go
8
utils.go
|
@ -311,7 +311,9 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
|
||||||
defer handler.Close()
|
defer handler.Close()
|
||||||
|
|
||||||
if err := container.Start(process); err != nil {
|
if err := container.Start(process); err != nil {
|
||||||
tty.Close()
|
if tty != nil {
|
||||||
|
tty.Close()
|
||||||
|
}
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +321,9 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
|
||||||
if err := createPidFile(pidFile, process); err != nil {
|
if err := createPidFile(pidFile, process); err != nil {
|
||||||
process.Signal(syscall.SIGKILL)
|
process.Signal(syscall.SIGKILL)
|
||||||
process.Wait()
|
process.Wait()
|
||||||
tty.Close()
|
if tty != nil {
|
||||||
|
tty.Close()
|
||||||
|
}
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue