Skip to content

Commit 66036d9

Browse files
committed
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 <[email protected]>
1 parent bc94455 commit 66036d9

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

runtime/v1/linux/runtime.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,11 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
372372
}).Error("opening shim stdout log pipe")
373373
continue
374374
}
375-
go io.Copy(os.Stdout, shimStdoutLog)
375+
if r.config.ShimDebug {
376+
go io.Copy(os.Stdout, shimStdoutLog)
377+
} else {
378+
go io.Copy(ioutil.Discard, shimStdoutLog)
379+
}
376380

377381
shimStderrLog, err := v1.OpenShimStderrLog(ctx, logDirPath)
378382
if err != nil {
@@ -383,7 +387,11 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
383387
}).Error("opening shim stderr log pipe")
384388
continue
385389
}
386-
go io.Copy(os.Stderr, shimStderrLog)
390+
if r.config.ShimDebug {
391+
go io.Copy(os.Stderr, shimStderrLog)
392+
} else {
393+
go io.Copy(ioutil.Discard, shimStderrLog)
394+
}
387395

388396
t, err := newTask(id, ns, pid, s, r.events, r.tasks, bundle)
389397
if err != nil {

0 commit comments

Comments
 (0)