Skip to content

Commit

Permalink
Merge pull request #563 from mlaventure/notty-detach-panic
Browse files Browse the repository at this point in the history
Prevent a panic when container fails to start
  • Loading branch information
LK4D4 committed Feb 16, 2016
2 parents 533ee4d + b011f80 commit 8ce2413
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,19 @@ 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
}

if pidFile != "" {
if err := createPidFile(pidFile, process); err != nil {
process.Signal(syscall.SIGKILL)
process.Wait()
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
}
Expand Down

0 comments on commit 8ce2413

Please sign in to comment.