mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-11-27 07:06:54 +01:00
Trimming spaces and newlines from result of Exec
This commit is contained in:
@@ -51,7 +51,7 @@ func Exec(path string, command string, args []string) string {
|
|||||||
|
|
||||||
// log.Println("Result: " + out.String()) // ... Silence ...
|
// log.Println("Result: " + out.String()) // ... Silence ...
|
||||||
|
|
||||||
return strings.Trim(out.String(), " ")
|
return strings.Trim(out.String(), " \n")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func TestExec(t *testing.T) {
|
|||||||
result := Exec("/", testCommand, testArguments)
|
result := Exec("/", testCommand, testArguments)
|
||||||
|
|
||||||
if result != "Hello World" {
|
if result != "Hello World" {
|
||||||
t.Log("Expected 'Hello World' but got ", result)
|
t.Log("Expected 'Hello World' but got ", "'"+result+"'")
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user