mirror of
https://github.com/gohugoio/hugo.git
synced 2025-01-24 03:23:48 +00:00
Use bufferpool in Asciidoc handler
This commit is contained in:
parent
ed5ad12af3
commit
068a77151e
1 changed files with 5 additions and 2 deletions
|
@ -23,6 +23,8 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"github.com/spf13/hugo/bufferpool"
|
||||||
|
|
||||||
"github.com/miekg/mmark"
|
"github.com/miekg/mmark"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/russross/blackfriday"
|
"github.com/russross/blackfriday"
|
||||||
|
@ -473,8 +475,9 @@ func getAsciidocContent(content []byte) []byte {
|
||||||
jww.INFO.Println("Rendering with", path, "...")
|
jww.INFO.Println("Rendering with", path, "...")
|
||||||
cmd := exec.Command(path, "--no-header-footer", "--safe", "-")
|
cmd := exec.Command(path, "--no-header-footer", "--safe", "-")
|
||||||
cmd.Stdin = bytes.NewReader(cleanContent)
|
cmd.Stdin = bytes.NewReader(cleanContent)
|
||||||
var out bytes.Buffer
|
out := bufferpool.GetBuffer()
|
||||||
cmd.Stdout = &out
|
defer bufferpool.PutBuffer(out)
|
||||||
|
cmd.Stdout = out
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
jww.ERROR.Println(err)
|
jww.ERROR.Println(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue