Skip to content

Commit 255da2a

Browse files
thepwagnerthaJeztah
authored andcommitted
runtime: log IO error when copying output streams
Signed-off-by: Peter Wagner <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 2bf4d3a commit 255da2a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

linux/proc/io.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"sync"
2727
"syscall"
2828

29+
"github.com/containerd/containerd/log"
2930
"github.com/containerd/fifo"
3031
runc "github.com/containerd/go-runc"
3132
)
@@ -52,7 +53,9 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w
5253
cwg.Done()
5354
p := bufPool.Get().(*[]byte)
5455
defer bufPool.Put(p)
55-
io.CopyBuffer(wc, rio.Stdout(), *p)
56+
if _, err := io.CopyBuffer(wc, rio.Stdout(), *p); err != nil {
57+
log.G(ctx).Warn("error copying stdout")
58+
}
5659
wg.Done()
5760
wc.Close()
5861
if rc != nil {
@@ -69,7 +72,9 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w
6972
cwg.Done()
7073
p := bufPool.Get().(*[]byte)
7174
defer bufPool.Put(p)
72-
io.CopyBuffer(wc, rio.Stderr(), *p)
75+
if _, err := io.CopyBuffer(wc, rio.Stderr(), *p); err != nil {
76+
log.G(ctx).Warn("error copying stderr")
77+
}
7378
wg.Done()
7479
wc.Close()
7580
if rc != nil {

0 commit comments

Comments
 (0)