From 2d3a4f99ece9db8d602dcf97eed7cfddbc4f296b Mon Sep 17 00:00:00 2001 From: Lifubang Date: Mon, 3 Dec 2018 18:31:21 +0800 Subject: [PATCH] should no defer when detach Signed-off-by: Lifubang --- cmd/ctr/commands/tasks/exec.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/ctr/commands/tasks/exec.go b/cmd/ctr/commands/tasks/exec.go index 9c99481de..9c5bce78b 100644 --- a/cmd/ctr/commands/tasks/exec.go +++ b/cmd/ctr/commands/tasks/exec.go @@ -94,7 +94,10 @@ var execCommand = cli.Command{ if err != nil { return err } - defer process.Delete(ctx) + // if detach, we should not call this defer + if !detach { + defer process.Delete(ctx) + } statusC, err := process.Wait(ctx) if err != nil {