Merge pull request #558 from rajasec/tty-panic

panic during start of failed detached container
This commit is contained in:
Michael Crosby 2016-02-16 16:01:08 -08:00
commit ce72f86a2b
1 changed files with 6 additions and 2 deletions

View File

@ -137,14 +137,18 @@ func restoreContainer(context *cli.Context, spec *specs.LinuxSpec, config *confi
handler := newSignalHandler(tty)
defer handler.Close()
if err := container.Restore(process, options); err != nil {
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
if pidFile := context.String("pid-file"); pidFile != "" {
if err := createPidFile(pidFile, process); err != nil {
process.Signal(syscall.SIGKILL)
process.Wait()
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
}