From 35442bc15642d476ead05582e5ec83f735ad5edf Mon Sep 17 00:00:00 2001 From: Paulo Truta Date: Sat, 12 Jun 2021 13:18:34 +0000 Subject: [PATCH] Trimming spaces and newlines from result of Exec --- internal/utils/utils.go | 2 +- internal/utils/utils_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 17f4422..16bfa8b 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -51,7 +51,7 @@ func Exec(path string, command string, args []string) string { // log.Println("Result: " + out.String()) // ... Silence ... - return strings.Trim(out.String(), " ") + return strings.Trim(out.String(), " \n") } diff --git a/internal/utils/utils_test.go b/internal/utils/utils_test.go index e68a7b2..a0670fd 100644 --- a/internal/utils/utils_test.go +++ b/internal/utils/utils_test.go @@ -14,7 +14,7 @@ func TestExec(t *testing.T) { result := Exec("/", testCommand, testArguments) if result != "Hello World" { - t.Log("Expected 'Hello World' but got ", result) + t.Log("Expected 'Hello World' but got ", "'"+result+"'") t.Fail() } }