Improve LookPath

This commit is contained in:
Bjørn Erik Pedersen
2020-12-18 18:20:12 +01:00
parent ae2d1bd52d
commit 10ae7c3210
18 changed files with 129 additions and 42 deletions

View File

@@ -16,9 +16,10 @@ package rst
import (
"bytes"
"os/exec"
"runtime"
"github.com/cli/safeexec"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/markup/internal"
@@ -96,9 +97,9 @@ func (c *rstConverter) getRstContent(src []byte, ctx converter.DocumentContext)
}
func getRstExecPath() string {
path, err := exec.LookPath("rst2html")
path, err := safeexec.LookPath("rst2html")
if err != nil {
path, err = exec.LookPath("rst2html.py")
path, err = safeexec.LookPath("rst2html.py")
if err != nil {
return ""
}