From 95df181a619005598ef1dcdc63fac1362684dc35 Mon Sep 17 00:00:00 2001 From: kwb0523 Date: Thu, 21 Sep 2023 20:25:38 +0800 Subject: [PATCH] fix mda output with newline symbol --- pkg/bpf/bpf.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/bpf/bpf.go b/pkg/bpf/bpf.go index 3bd4c2f..2fde00f 100644 --- a/pkg/bpf/bpf.go +++ b/pkg/bpf/bpf.go @@ -21,6 +21,7 @@ package bpf import ( "fmt" "os/exec" + "strings" "github.com/cilium/ebpf" "github.com/cilium/ebpf/rlimit" @@ -71,11 +72,11 @@ func StartMda() error { cmd := exec.Command("mdacore", "enable") output, err := cmd.CombinedOutput() if err != nil { - log.Error(string(output)) + log.Error(strings.Replace(string(output), "\n", " ", -1)) return err } - log.Info(string(output)) + log.Info(strings.Replace(string(output), "\n", " ", -1)) return nil } @@ -103,11 +104,11 @@ func StopMda() error { cmd := exec.Command("mdacore", "disable") output, err := cmd.CombinedOutput() if err != nil { - log.Error(string(output)) + log.Error(strings.Replace(string(output), "\n", " ", -1)) return err } - log.Info(string(output)) + log.Info(strings.Replace(string(output), "\n", " ", -1)) return nil } -- Gitee