shim executor: clean state dir if newProcess() failed

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2017-01-18 09:08:36 +00:00
parent abc1bf4dea
commit d92f60e367
1 changed files with 5 additions and 0 deletions

View File

@ -35,6 +35,11 @@ func newProcess(ctx context.Context, o newProcessOpts) (*process, error) {
if err != nil {
return nil, err
}
defer func() {
if err != nil {
o.container.StateDir().DeleteProcess(o.ID)
}
}()
exitPipe, controlPipe, err := getControlPipes(procStateDir)
if err != nil {