Merge pull request #808 from Random-Liu/disable-stdin-in-terminal

Make it possible to disable stdin when terminal is enabled
This commit is contained in:
Derek McGowan 2017-05-05 13:50:02 -07:00 committed by GitHub
commit 1d9dcf7b6a

View File

@ -15,11 +15,13 @@ import (
) )
func copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg *sync.WaitGroup) error { 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 stdin != "" {
if err != nil { in, err := fifo.OpenFifo(ctx, stdin, syscall.O_RDONLY, 0)
return err 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) outw, err := fifo.OpenFifo(ctx, stdout, syscall.O_WRONLY, 0)
if err != nil { if err != nil {
return err return err