From 9d251cbd1b0876d346fb377a99e268f5d9d77c5e Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Fri, 1 Sep 2017 09:38:03 -0700 Subject: [PATCH] Delete bundle dir on restore if we're not debugging the shim Signed-off-by: Kenfe-Mickael Laventure --- linux/runtime.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux/runtime.go b/linux/runtime.go index 6f6567aaa..7b7d2b6a7 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -364,7 +364,10 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { func (r *Runtime) cleanupAfterDeadShim(ctx context.Context, bundle *bundle, ns, id string, pid int, ec chan runc.Exit) error { ctx = namespaces.WithNamespace(ctx, ns) if err := r.terminate(ctx, bundle, ns, id); err != nil { - return errors.New("failed to terminate task, leaving bundle for debugging") + if r.config.ShimDebug { + return errors.Wrap(err, "failed to terminate task, leaving bundle for debugging") + } + log.G(ctx).WithError(err).Warn("failed to terminate task") } if ec != nil {