diff options
author | Joe Mooring <[email protected]> | 2022-01-06 21:19:13 -0800 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-01-07 10:46:32 +0100 |
commit | 0aca99fe0168a3e7773d8e98751154c164e6949f (patch) | |
tree | ebdb33790268f6ad42aecfbde9c3426aeebcb63b /create | |
parent | c8b5ab75b743914f89b51046eee8e3daa2eb1eec (diff) | |
download | hugo-0aca99fe0168a3e7773d8e98751154c164e6949f.tar.gz hugo-0aca99fe0168a3e7773d8e98751154c164e6949f.zip |
create: Correctly pass newContentEditor flags
Fixes #9356
Diffstat (limited to 'create')
-rw-r--r-- | create/content.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/create/content.go b/create/content.go index 6ae912882..400cff341 100644 --- a/create/content.go +++ b/create/content.go @@ -343,15 +343,24 @@ func (b *contentBuilder) openInEditorIfConfigured(filename string) error { return nil } - b.h.Log.Printf("Editing %q with %q ...\n", filename, editor) - cmd, err := b.h.Deps.ExecHelper.New( - editor, + editorExec := strings.Fields(editor)[0] + editorFlags := strings.Fields(editor)[1:] + + var args []interface{} + for _, editorFlag := range editorFlags { + args = append(args, editorFlag) + } + args = append( + args, filename, hexec.WithStdin(os.Stdin), hexec.WithStderr(os.Stderr), hexec.WithStdout(os.Stdout), ) + b.h.Log.Printf("Editing %q with %q ...\n", filename, editorExec) + + cmd, err := b.h.Deps.ExecHelper.New(editorExec, args...) if err != nil { return err } |