From c21cbc502103f496b2c3bcb9b929ae0457aa4179 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 16 Mar 2017 12:06:12 -0700 Subject: [PATCH] cmd/lncli: append a new-line when using encoding/json to print resp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was noticed by 21E14 on Github that when we fall back to using golang’s encoding/json lib in special cases when printing the proto responses in JSON form, the value printed lacked a new-line at the end. This would cause the output to flow into bash prompts. This issue has been fixed by simply appending a newline character to the end of the formatted JSON output. Fixes #160. --- cmd/lncli/commands.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index f33bea812..381fbf1cd 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -34,6 +34,7 @@ func printJSON(resp interface{}) { var out bytes.Buffer json.Indent(&out, b, "", "\t") + out.WriteString("\n") out.WriteTo(os.Stdout) }