diff --git a/build b/build index a7f6a8cd2..f6605f52a 100755 --- a/build +++ b/build @@ -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 diff --git a/ssh/ssh.go b/ssh/ssh.go index ca02dd949..3e1e75cc3 100644 --- a/ssh/ssh.go +++ b/ssh/ssh.go @@ -18,6 +18,7 @@ import ( "errors" "net" "os" + "io" "strconv" "strings" "time" @@ -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 } @@ -89,6 +93,8 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize finalize = func() { session.Close() + sshReader.Close() + sshWriter.Close() terminal.Restore(fd, oldState) } @@ -101,6 +107,8 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize } else { finalize = func() { session.Close() + sshReader.Close() + sshWriter.Close() } }