Skip to content

Commit 7b9ce79

Browse files
committed
trim sensor outputs
1 parent 06ca581 commit 7b9ce79

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/cmd/executor.go

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"go.uber.org/zap"
77
"os/exec"
8+
"strings"
89
"sync"
910
"time"
1011
)
@@ -36,6 +37,11 @@ func (c *CommandExecutor) ExecuteCommandWithContext(cmd string, args []string, e
3637
command := exec.CommandContext(ctx, cmd, args...)
3738
out, execErr := command.CombinedOutput()
3839

40+
if len(out) > 0 {
41+
//trim combined output
42+
out = []byte(strings.Trim(string(out), " \n"))
43+
}
44+
3945
if execErr != nil && ctx.Err() == nil {
4046
zap.L().Error("Command execution failed.", zap.Error(execErr))
4147
} else if ctx.Err() != nil {

0 commit comments

Comments
 (0)