Merge pull request #510 from thockin/v3-trimspace

TrimSpace exec's stdout/stderr for log (v3)
This commit is contained in:
Kubernetes Prow Robot 2022-03-20 13:33:10 -07:00 committed by GitHub
commit 425915398d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -61,8 +61,8 @@ func (c *Runner) RunWithStdin(ctx context.Context, cwd string, env []string, std
cmd.Stdin = bytes.NewBufferString(stdin)
err := cmd.Run()
stdout := outbuf.String()
stderr := errbuf.String()
stdout := strings.TrimSpace(outbuf.String())
stderr := strings.TrimSpace(errbuf.String())
if ctx.Err() == context.DeadlineExceeded {
return "", fmt.Errorf("Run(%s): %w: { stdout: %q, stderr: %q }", cmdStr, ctx.Err(), stdout, stderr)
}