Improve LookPath

This commit is contained in:
Bjørn Erik Pedersen 2020-12-18 18:20:12 +01:00
parent ae2d1bd52d
commit 10ae7c3210
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
18 changed files with 129 additions and 42 deletions

View file

@ -18,12 +18,12 @@ import (
"bytes"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/pkg/errors"
"github.com/gohugoio/hugo/common/hexec"
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/hugofs"
@ -105,7 +105,10 @@ func NewContent(
jww.FEEDBACK.Printf("Editing %s with %q ...\n", targetPath, editor)
editorCmd := append(strings.Fields(editor), contentPath)
cmd := exec.Command(editorCmd[0], editorCmd[1:]...)
cmd, err := hexec.SafeCommand(editorCmd[0], editorCmd[1:]...)
if err != nil {
return err
}
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr