Skip to content

Commit

Permalink
trim space from exec plugin out/err
Browse files Browse the repository at this point in the history
Removes trailing whitespace/newlines from the stdout and stderr debug
output for the exec plugin.

Signed-off-by: Jay Pipes <[email protected]>
  • Loading branch information
jaypipes committed Jul 8, 2024
1 parent abdb914 commit 0d3fecd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugin/exec/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"context"
"os/exec"
"strings"

"github.com/gdt-dev/gdt/api"
gdtcontext "github.com/gdt-dev/gdt/context"
Expand Down Expand Up @@ -79,15 +80,21 @@ 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 {
if _, err = errbuf.ReadFrom(errpipe); err != nil {
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()),
)
}
}

Expand Down

0 comments on commit 0d3fecd

Please sign in to comment.