Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-18 20:20:12 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-19 19:03:07 +0300
commit10ae7c3210cd1add14d3750aa9512a87df0e1146 (patch)
tree6fa7eb1e9bfe093f3b611bbb286aefe591e1dc7a /tpl
parentae2d1bd52df0099190ef9195666d0788708b0385 (diff)
Improve LookPath
Diffstat (limited to 'tpl')
-rw-r--r--tpl/internal/go_templates/testenv/testenv.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/tpl/internal/go_templates/testenv/testenv.go b/tpl/internal/go_templates/testenv/testenv.go
index 90044570d..f5ea398fb 100644
--- a/tpl/internal/go_templates/testenv/testenv.go
+++ b/tpl/internal/go_templates/testenv/testenv.go
@@ -13,7 +13,6 @@ package testenv
import (
"errors"
"flag"
- "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg"
"os"
"os/exec"
"path/filepath"
@@ -22,6 +21,9 @@ import (
"strings"
"sync"
"testing"
+
+ "github.com/cli/safeexec"
+ "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg"
)
// Builder reports the name of the builder running this test
@@ -111,7 +113,7 @@ func GoTool() (string, error) {
if _, err := os.Stat(path); err == nil {
return path, nil
}
- goBin, err := exec.LookPath("go" + exeSuffix)
+ goBin, err := safeexec.LookPath("go" + exeSuffix)
if err != nil {
return "", errors.New("cannot find go tool: " + err.Error())
}
@@ -162,7 +164,7 @@ func MustHaveExecPath(t testing.TB, path string) {
err, found := execPaths.Load(path)
if !found {
- _, err = exec.LookPath(path)
+ _, err = safeexec.LookPath(path)
err, _ = execPaths.LoadOrStore(path, err)
}
if err != nil {