mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #563 from mlaventure/notty-detach-panic
Prevent a panic when container fails to start
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user