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
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 /hugolib
parentae2d1bd52df0099190ef9195666d0788708b0385 (diff)
Improve LookPath
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/js_test.go10
-rw-r--r--hugolib/resource_chain_babel_test.go6
-rw-r--r--hugolib/resource_chain_test.go7
3 files changed, 16 insertions, 7 deletions
diff --git a/hugolib/js_test.go b/hugolib/js_test.go
index fbbd335b3..8d8e015a6 100644
--- a/hugolib/js_test.go
+++ b/hugolib/js_test.go
@@ -16,11 +16,12 @@ package hugolib
import (
"fmt"
"os"
- "os/exec"
"path/filepath"
"runtime"
"testing"
+ "github.com/gohugoio/hugo/common/hexec"
+
"github.com/gohugoio/hugo/htesting"
"github.com/spf13/viper"
@@ -125,7 +126,9 @@ TS: {{ template "print" $ts }}
b.WithSourceFile("assets/js/included.js", includedJS)
- out, err := exec.Command("npm", "install").CombinedOutput()
+ cmd, err := hexec.SafeCommand("npm", "install")
+ b.Assert(err, qt.IsNil)
+ out, err := cmd.CombinedOutput()
b.Assert(err, qt.IsNil, qt.Commentf(string(out)))
b.Build(BuildCfg{})
@@ -193,7 +196,8 @@ require github.com/gohugoio/hugoTestProjectJSModImports v0.5.0 // indirect
}`)
b.Assert(os.Chdir(workDir), qt.IsNil)
- _, err = exec.Command("npm", "install").CombinedOutput()
+ cmd, _ := hexec.SafeCommand("npm", "install")
+ _, err = cmd.CombinedOutput()
b.Assert(err, qt.IsNil)
b.Build(BuildCfg{})
diff --git a/hugolib/resource_chain_babel_test.go b/hugolib/resource_chain_babel_test.go
index e56c037f1..da03c83c7 100644
--- a/hugolib/resource_chain_babel_test.go
+++ b/hugolib/resource_chain_babel_test.go
@@ -16,11 +16,12 @@ package hugolib
import (
"bytes"
"os"
- "os/exec"
"path/filepath"
"runtime"
"testing"
+ "github.com/gohugoio/hugo/common/hexec"
+
jww "github.com/spf13/jwalterweatherman"
"github.com/gohugoio/hugo/htesting"
@@ -111,7 +112,8 @@ Transpiled: {{ $transpiled.Content | safeJS }}
b.WithSourceFile("babel.config.js", babelConfig)
b.Assert(os.Chdir(workDir), qt.IsNil)
- _, err = exec.Command("npm", "install").CombinedOutput()
+ cmd, _ := hexec.SafeCommand("npm", "install")
+ _, err = cmd.CombinedOutput()
b.Assert(err, qt.IsNil)
b.Build(BuildCfg{})
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index 4f93115f9..b5baa4d0b 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -19,13 +19,15 @@ import (
"io"
"math/rand"
"os"
- "os/exec"
+
"path/filepath"
"runtime"
"strings"
"testing"
"time"
+ "github.com/gohugoio/hugo/common/hexec"
+
jww "github.com/spf13/jwalterweatherman"
"github.com/gohugoio/hugo/common/herrors"
@@ -930,7 +932,8 @@ class-in-b {
b.WithSourceFile("postcss.config.js", postcssConfig)
b.Assert(os.Chdir(workDir), qt.IsNil)
- _, err = exec.Command("npm", "install").CombinedOutput()
+ cmd, err := hexec.SafeCommand("npm", "install")
+ _, err = cmd.CombinedOutput()
b.Assert(err, qt.IsNil)
b.Build(BuildCfg{})