From 46a43785319bf0453441050b0b461ab45e7cd443 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 11 Feb 2017 16:06:45 +0300 Subject: [PATCH] read response in remote commands --- client.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client.go b/client.go index af0a66b..1674b79 100644 --- a/client.go +++ b/client.go @@ -166,5 +166,15 @@ func sendRemote(cmd string) error { fmt.Fprintln(c, cmd) + s := bufio.NewScanner(c) + + s.Scan() + + fmt.Println(s.Text()) + + if s.Err() != nil { + return fmt.Errorf("reading response: %s", s.Err()) + } + return nil }