Skip to content

Commit

Permalink
ssh: workaround to not block Stdin from returning corrrectly
Browse files Browse the repository at this point in the history
Assign session.stdin using StdinPipe() to avoid cases of ssh connetions
being blocked on user input.

WIP.

Reported-by: kayrus <kay.diam@gmail.com>
maybe partly resolves coreos#1499
  • Loading branch information
Dongsu Park committed Jun 24, 2016
1 parent e4f2123 commit 6dc4357
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package ssh

import (
"errors"
"io"
"net"
"os"
"strconv"
Expand Down Expand Up @@ -72,7 +73,17 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize

session.Stdout = os.Stdout
session.Stderr = os.Stderr
session.Stdin = os.Stdin

// Workaround to not prevent Stdin from returning.
inPipe, err := session.StdinPipe()
if err != nil {
return
}

go func() {
io.Copy(inPipe, os.Stdin)
inPipe.Close()
}()

modes := gossh.TerminalModes{
gossh.ECHO: 1, // enable echoing
Expand Down

0 comments on commit 6dc4357

Please sign in to comment.