From d3a30fd41c2490a3b4e4b7138b91b5b04401fb9c Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Tue, 25 Aug 2015 12:11:21 +0200 Subject: [PATCH] Set terminal to raw mode --- gotty-client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gotty-client.go b/gotty-client.go index 4de4ef8..a8d69fb 100644 --- a/gotty-client.go +++ b/gotty-client.go @@ -11,6 +11,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/gorilla/websocket" + "golang.org/x/crypto/ssh/terminal" ) // GetWebsocketURL transforms a GoTTY http URL to its WebSocket URL @@ -71,6 +72,11 @@ func (c *Client) Loop() error { } func (c *Client) writeLoop(done chan bool) { + oldState, err := terminal.MakeRaw(0) + if err == nil { + defer terminal.Restore(0, oldState) + } + reader := bufio.NewReader(os.Stdin) for { x, size, err := reader.ReadRune()