Skip to content

Commit 068a771

Browse files
committed
Use bufferpool in Asciidoc handler
1 parent ed5ad12 commit 068a771

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

helpers/content.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"os/exec"
2424
"unicode/utf8"
2525

26+
"github.com/spf13/hugo/bufferpool"
27+
2628
"github.com/miekg/mmark"
2729
"github.com/mitchellh/mapstructure"
2830
"github.com/russross/blackfriday"
@@ -473,8 +475,9 @@ func getAsciidocContent(content []byte) []byte {
473475
jww.INFO.Println("Rendering with", path, "...")
474476
cmd := exec.Command(path, "--no-header-footer", "--safe", "-")
475477
cmd.Stdin = bytes.NewReader(cleanContent)
476-
var out bytes.Buffer
477-
cmd.Stdout = &out
478+
out := bufferpool.GetBuffer()
479+
defer bufferpool.PutBuffer(out)
480+
cmd.Stdout = out
478481
if err := cmd.Run(); err != nil {
479482
jww.ERROR.Println(err)
480483
}

0 commit comments

Comments
 (0)