From 42dec3c5aaf633593d7851d81e7d8d56c4c34e12 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Thu, 29 Aug 2024 14:31:19 +0200 Subject: [PATCH] fix: assume valid json in events output --- features/dapp_develop/cli.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/features/dapp_develop/cli.go b/features/dapp_develop/cli.go index 076e2d7..0f26e92 100644 --- a/features/dapp_develop/cli.go +++ b/features/dapp_develop/cli.go @@ -93,17 +93,13 @@ func getEventsFromCliTool(ledgerFrom uint32, deployedContractId string, size uin status, stdOutLines, err := e2e.RunCommand(envCmd, e2eConfig) var jsonEvents []map[string]interface{} - var stdOutLinesTrimmed []string if status != 0 || err != nil { return jsonEvents, fmt.Errorf("soroban cli get events had error %v, %v", status, err) } - // put commas between any json event objects if more than one found - stdOutEventsValidJson := strings.ReplaceAll(strings.Join(stdOutLinesTrimmed, "\n"), `\n}\n{\n`, `\n}\n,\n{\n`) - // wrap the json objects in json array brackets - stdOutEventsValidJson = "[" + stdOutEventsValidJson + "]" - + // join into one string + stdOutEventsValidJson := strings.Join(stdOutLines, "\n") err = json.Unmarshal([]byte(stdOutEventsValidJson), &jsonEvents) if err != nil { return jsonEvents, fmt.Errorf("soroban cli get events console output %v was not parseable as event json, %e", strings.Join(stdOutLines, "\n"), err)