From d92f60e3674d51b3b78e7afa671451b42cd26766 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Wed, 18 Jan 2017 09:08:36 +0000 Subject: [PATCH] shim executor: clean state dir if newProcess() failed Signed-off-by: Akihiro Suda --- execution/executors/shim/process.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/execution/executors/shim/process.go b/execution/executors/shim/process.go index f659a57..b1045cc 100644 --- a/execution/executors/shim/process.go +++ b/execution/executors/shim/process.go @@ -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 {