From e96ac2040db90a7d9e4225b78ccc6bff373f8aeb Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Thu, 28 Mar 2019 12:59:48 -0700 Subject: [PATCH] runtime: log IO error when copying output streams Signed-off-by: Peter Wagner --- runtime/v1/linux/proc/io.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/runtime/v1/linux/proc/io.go b/runtime/v1/linux/proc/io.go index b37c3c6aa..34f6800e2 100644 --- a/runtime/v1/linux/proc/io.go +++ b/runtime/v1/linux/proc/io.go @@ -29,6 +29,7 @@ import ( "sync" "syscall" + "github.com/containerd/containerd/log" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/runtime/proc" "github.com/containerd/fifo" @@ -136,7 +137,9 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w cwg.Done() p := bufPool.Get().(*[]byte) defer bufPool.Put(p) - io.CopyBuffer(wc, rio.Stdout(), *p) + if _, err := io.CopyBuffer(wc, rio.Stdout(), *p); err != nil { + log.G(ctx).Warn("error copying stdout") + } wg.Done() wc.Close() if rc != nil { @@ -153,7 +156,9 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w cwg.Done() p := bufPool.Get().(*[]byte) defer bufPool.Put(p) - io.CopyBuffer(wc, rio.Stderr(), *p) + if _, err := io.CopyBuffer(wc, rio.Stderr(), *p); err != nil { + log.G(ctx).Warn("error copying stderr") + } wg.Done() wc.Close() if rc != nil {