diff options
author | Jonathan Tran <jon@allspice.io> | 2023-01-14 18:14:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-14 23:14:27 +0000 |
commit | 7b60d47c3c7ed2bee40a47e2fd87b7613cdd6b68 (patch) | |
tree | c7626c22f2f7a9a2e437e7d878165394c1a1eccb /modules | |
parent | 265d438a6e44ead4c982790bcd9b5854e7d646da (diff) | |
download | gitea-7b60d47c3c7ed2bee40a47e2fd87b7613cdd6b68.tar.gz gitea-7b60d47c3c7ed2bee40a47e2fd87b7613cdd6b68.zip |
Log STDERR of external renderer when it fails (#22442) (#22444)
Backport #22442.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/markup/external/external.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/markup/external/external.go b/modules/markup/external/external.go index 0eeb2d70a5..230cbccaac 100644 --- a/modules/markup/external/external.go +++ b/modules/markup/external/external.go @@ -5,6 +5,7 @@ package external import ( + "bytes" "fmt" "io" "os" @@ -133,11 +134,13 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io. if !p.IsInputFile { cmd.Stdin = input } + var stderr bytes.Buffer cmd.Stdout = output + cmd.Stderr = &stderr process.SetSysProcAttribute(cmd) if err := cmd.Run(); err != nil { - return fmt.Errorf("%s render run command %s %v failed: %w", p.Name(), commands[0], args, err) + return fmt.Errorf("%s render run command %s %v failed: %w\nStderr: %s", p.Name(), commands[0], args, err, stderr.String()) } return nil } |