From e1cfb292559a3dc5a87ee7564bfffc2e72a80ae1 Mon Sep 17 00:00:00 2001 From: Patrik Cyvoct Date: Mon, 30 Apr 2018 13:27:21 +0200 Subject: [PATCH] Add test to check if escapeKeys is empty Signed-off-by: Patrik Cyvoct --- proxy.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy.go b/proxy.go index e42143c..212017d 100644 --- a/proxy.go +++ b/proxy.go @@ -13,7 +13,6 @@ // CHANGES: // - update package - package gottyclient import ( @@ -50,6 +49,10 @@ func NewEscapeProxy(r io.Reader, escapeKeys []byte) io.Reader { func (r *escapeProxy) Read(buf []byte) (int, error) { nr, err := r.r.Read(buf) + if len(r.escapeKeys) == 0 { + return nr, err + } + preserve := func() { // this preserves the original key presses in the passed in buffer nr += r.escapeKeyPos