Use bufferpool in Asciidoc handler

This commit is contained in:
Bjørn Erik Pedersen 2016-07-10 12:31:31 +02:00
parent ed5ad12af3
commit 068a77151e

View file

@ -23,6 +23,8 @@ import (
"os/exec"
"unicode/utf8"
"github.com/spf13/hugo/bufferpool"
"github.com/miekg/mmark"
"github.com/mitchellh/mapstructure"
"github.com/russross/blackfriday"
@ -473,8 +475,9 @@ func getAsciidocContent(content []byte) []byte {
jww.INFO.Println("Rendering with", path, "...")
cmd := exec.Command(path, "--no-header-footer", "--safe", "-")
cmd.Stdin = bytes.NewReader(cleanContent)
var out bytes.Buffer
cmd.Stdout = &out
out := bufferpool.GetBuffer()
defer bufferpool.PutBuffer(out)
cmd.Stdout = out
if err := cmd.Run(); err != nil {
jww.ERROR.Println(err)
}