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 <liyuxuan04@baidu.com>
This commit is contained in:
Li Yuxuan 2019-05-13 10:44:51 +08:00 committed by darfux
parent bc944553a8
commit 66036d9206

View File

@ -372,7 +372,11 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
}).Error("opening shim stdout log pipe")
continue
}
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
}
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 {