From f04d74d099d87e068af3ea8ea15c198bcd2b7071 Mon Sep 17 00:00:00 2001 From: Random-Liu Date: Fri, 5 May 2017 13:34:29 -0700 Subject: [PATCH] Make it possible to disable stdin when terminal is enabled Signed-off-by: Random-Liu --- linux/shim/io.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/linux/shim/io.go b/linux/shim/io.go index 60e41b8c4..2194a99e2 100644 --- a/linux/shim/io.go +++ b/linux/shim/io.go @@ -15,11 +15,13 @@ import ( ) func copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg *sync.WaitGroup) error { - in, err := fifo.OpenFifo(ctx, stdin, syscall.O_RDONLY, 0) - if err != nil { - return err + if stdin != "" { + in, err := fifo.OpenFifo(ctx, stdin, syscall.O_RDONLY, 0) + if err != nil { + return err + } + go io.Copy(console, in) } - go io.Copy(console, in) outw, err := fifo.OpenFifo(ctx, stdout, syscall.O_WRONLY, 0) if err != nil { return err