Skip to content

Commit e96ac20

Browse files
committed
runtime: log IO error when copying output streams
Signed-off-by: Peter Wagner <[email protected]>
1 parent 2d0a06d commit e96ac20

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • runtime/v1/linux/proc

runtime/v1/linux/proc/io.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"sync"
3030
"syscall"
3131

32+
"github.com/containerd/containerd/log"
3233
"github.com/containerd/containerd/namespaces"
3334
"github.com/containerd/containerd/runtime/proc"
3435
"github.com/containerd/fifo"
@@ -136,7 +137,9 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w
136137
cwg.Done()
137138
p := bufPool.Get().(*[]byte)
138139
defer bufPool.Put(p)
139-
io.CopyBuffer(wc, rio.Stdout(), *p)
140+
if _, err := io.CopyBuffer(wc, rio.Stdout(), *p); err != nil {
141+
log.G(ctx).Warn("error copying stdout")
142+
}
140143
wg.Done()
141144
wc.Close()
142145
if rc != nil {
@@ -153,7 +156,9 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w
153156
cwg.Done()
154157
p := bufPool.Get().(*[]byte)
155158
defer bufPool.Put(p)
156-
io.CopyBuffer(wc, rio.Stderr(), *p)
159+
if _, err := io.CopyBuffer(wc, rio.Stderr(), *p); err != nil {
160+
log.G(ctx).Warn("error copying stderr")
161+
}
157162
wg.Done()
158163
wc.Close()
159164
if rc != nil {

0 commit comments

Comments
 (0)