From 2dc2a8ec991f185262e643931e29704844cdb92b Mon Sep 17 00:00:00 2001 From: DaanSelen Date: Wed, 1 Apr 2026 09:58:31 +0200 Subject: [PATCH] chore: try to strip ansi escape characters --- src/modules/runner/runner.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/runner/runner.go b/src/modules/runner/runner.go index eda4bca..61cd3dd 100644 --- a/src/modules/runner/runner.go +++ b/src/modules/runner/runner.go @@ -4,9 +4,12 @@ import ( "log" "os" "os/exec" + "regexp" "runtime" ) +var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`) + func FindMeshbookBinary() (bool, string) { var osBin string @@ -53,11 +56,14 @@ func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) { cmd := exec.Command(binPath, args...) outputData, err := cmd.CombinedOutput() + cleanData := ansi.ReplaceAllString(string(outputData), "") + if err != nil { log.Printf("something went wrong when running the command: %v", err) - log.Printf("captured output: %s", string(outputData)) - return false, string(outputData) - } + log.Printf("captured output: %s", cleanData) - return true, string(outputData) + return false, cleanData + } else { + return true, cleanData + } }