From 66036d9206ceaef83005260700d7e0b13b057830 Mon Sep 17 00:00:00 2001 From: Li Yuxuan Date: Mon, 13 May 2019 10:44:51 +0800 Subject: [PATCH] v1: Respect the `shim_debug` flag when load tasks Currently when we restart containerd it will load all tasks with shim logs whether the `shim_debug` is set or not. Signed-off-by: Li Yuxuan --- runtime/v1/linux/runtime.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/runtime/v1/linux/runtime.go b/runtime/v1/linux/runtime.go index c408126ae..ceb30f178 100644 --- a/runtime/v1/linux/runtime.go +++ b/runtime/v1/linux/runtime.go @@ -372,7 +372,11 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { }).Error("opening shim stdout log pipe") continue } - go io.Copy(os.Stdout, shimStdoutLog) + if r.config.ShimDebug { + go io.Copy(os.Stdout, shimStdoutLog) + } else { + go io.Copy(ioutil.Discard, shimStdoutLog) + } shimStderrLog, err := v1.OpenShimStderrLog(ctx, logDirPath) if err != nil { @@ -383,7 +387,11 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { }).Error("opening shim stderr log pipe") continue } - go io.Copy(os.Stderr, shimStderrLog) + if r.config.ShimDebug { + go io.Copy(os.Stderr, shimStderrLog) + } else { + go io.Copy(ioutil.Discard, shimStderrLog) + } t, err := newTask(id, ns, pid, s, r.events, r.tasks, bundle) if err != nil {