diff --git a/console/command_executer.go b/console/command_executer.go index 9ffcd7b58..c379ea0db 100644 --- a/console/command_executer.go +++ b/console/command_executer.go @@ -107,9 +107,9 @@ func (ce *CommandExecuter) LocalExecute() string { } func ToJSON(line string) (jsn []byte) { - // if !strings.Contains(line, "=") { - // line = fmt.Sprintf("Item=\"%s\"", line) - // } + if !strings.Contains(line, "=") && line != "" { + line = fmt.Sprintf("Item=\"%s\"", line) + } jsn = append(jsn, '{') for _, group := range lineR.FindAllStringSubmatch(line, -1) { if len(group) == 3 { diff --git a/console/command_executer_test.go b/console/command_executer_test.go index 843fc914c..765e2d768 100644 --- a/console/command_executer_test.go +++ b/console/command_executer_test.go @@ -40,7 +40,7 @@ func TestToJSONValid(t *testing.T) { func TestToJSONEmpty(t *testing.T) { jsn := ToJSON("") - if string(jsn) != `{"Item":""}` { + if string(jsn) != `{}` { t.Error("Error empty: ", string(jsn)) } }