From 0d3fecdcd7e38b0a9517d53315ed8bf8360c55d3 Mon Sep 17 00:00:00 2001 From: Jay Pipes Date: Mon, 8 Jul 2024 11:56:18 -0400 Subject: [PATCH] trim space from exec plugin out/err Removes trailing whitespace/newlines from the stdout and stderr debug output for the exec plugin. Signed-off-by: Jay Pipes --- plugin/exec/action.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/exec/action.go b/plugin/exec/action.go index 687f5ef..a4e820f 100644 --- a/plugin/exec/action.go +++ b/plugin/exec/action.go @@ -8,6 +8,7 @@ import ( "bytes" "context" "os/exec" + "strings" "github.com/gdt-dev/gdt/api" gdtcontext "github.com/gdt-dev/gdt/context" @@ -79,7 +80,10 @@ func (a *Action) Do( debug.Println(ctx, "exec: error reading from stdout: %s", err) } if outbuf.Len() > 0 { - debug.Println(ctx, "exec: stdout: %s", outbuf.String()) + debug.Println( + ctx, "exec: stdout: %s", + strings.TrimSpace(outbuf.String()), + ) } } if errbuf != nil { @@ -87,7 +91,10 @@ func (a *Action) Do( debug.Println(ctx, "exec: error reading from stderr: %s", err) } if errbuf.Len() > 0 { - debug.Println(ctx, "exec: stderr: %s", errbuf.String()) + debug.Println( + ctx, "exec: stderr: %s", + strings.TrimSpace(errbuf.String()), + ) } }