From 9a5b17009c836462ea998b53e5b530383098c2b6 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Tue, 17 Jan 2017 19:04:20 +0800 Subject: [PATCH] Fix io closer Signed-off-by: Qiang Huang --- cmd/ctr/utils.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/ctr/utils.go b/cmd/ctr/utils.go index aaa3134..ba26ebe 100644 --- a/cmd/ctr/utils.go +++ b/cmd/ctr/utils.go @@ -36,9 +36,9 @@ func prepareStdio(stdin, stdout, stderr string, console bool) (*sync.WaitGroup, c.Close() } }(f) - go func(w io.Writer) { + go func(w io.WriteCloser) { io.Copy(w, os.Stdin) - f.Close() + w.Close() }(f) f, err = fifo.OpenFifo(ctx, stdout, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700) @@ -51,9 +51,9 @@ func prepareStdio(stdin, stdout, stderr string, console bool) (*sync.WaitGroup, } }(f) wg.Add(1) - go func(r io.Reader) { + go func(r io.ReadCloser) { io.Copy(os.Stdout, r) - f.Close() + r.Close() wg.Done() }(f) @@ -68,9 +68,9 @@ func prepareStdio(stdin, stdout, stderr string, console bool) (*sync.WaitGroup, }(f) if !console { wg.Add(1) - go func(r io.Reader) { + go func(r io.ReadCloser) { io.Copy(os.Stderr, r) - f.Close() + r.Close() wg.Done() }(f) }