Skip to content

Commit

Permalink
fleetctl: fixed broken ssh terminal coreos#1499
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Apr 13, 2016
1 parent 83c4099 commit 29e0ecc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ ! -h gopath/src/${REPO_PATH} ]; then
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi

if [ ${GOOS} = "linux" ]; then
if [ ${GOOS} = "linux1" ]; then
echo "Building fleetd..."
CGO_ENABLED=0 go build -o bin/fleetd -a -installsuffix netgo -ldflags "${GLDFLAGS}" ${REPO_PATH}/fleetd
else
Expand Down
10 changes: 9 additions & 1 deletion ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"errors"
"net"
"os"
"io"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -68,10 +69,13 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize

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

sshReader, sshWriter := io.Pipe()
session.Stdin = sshReader

modes := gossh.TerminalModes{
gossh.ECHO: 1, // enable echoing
gossh.ONLCR: 0, // removes ^M
gossh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud
gossh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
}
Expand All @@ -89,6 +93,8 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize

finalize = func() {
session.Close()
sshReader.Close()
sshWriter.Close()
terminal.Restore(fd, oldState)
}

Expand All @@ -101,6 +107,8 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize
} else {
finalize = func() {
session.Close()
sshReader.Close()
sshWriter.Close()
}
}

Expand Down

0 comments on commit 29e0ecc

Please sign in to comment.