loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Log STDERR of external renderer when it fails (#22442)

When using an external renderer, STDOUT is expected to be HTML. But
anything written to STDERR is currently ignored. In cases where the
renderer fails, I would like to log any error messages that the external
program outputs to STDERR.

authored by

Jonathan Tran and committed by
GitHub
02ae6329 a3ab82e5

+4 -1
+4 -1
modules/markup/external/external.go
··· 4 4 package external 5 5 6 6 import ( 7 + "bytes" 7 8 "fmt" 8 9 "io" 9 10 "os" ··· 132 133 if !p.IsInputFile { 133 134 cmd.Stdin = input 134 135 } 136 + var stderr bytes.Buffer 135 137 cmd.Stdout = output 138 + cmd.Stderr = &stderr 136 139 process.SetSysProcAttribute(cmd) 137 140 138 141 if err := cmd.Run(); err != nil { 139 - return fmt.Errorf("%s render run command %s %v failed: %w", p.Name(), commands[0], args, err) 142 + return fmt.Errorf("%s render run command %s %v failed: %w\nStderr: %s", p.Name(), commands[0], args, err, stderr.String()) 140 143 } 141 144 return nil 142 145 }