hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 0aca99fe0168a3e7773d8e98751154c164e6949f
parent c8b5ab75b743914f89b51046eee8e3daa2eb1eec
Author: Joe Mooring <joe.mooring@veriphor.com>
Date:   Thu,  6 Jan 2022 21:19:13 -0800

create: Correctly pass newContentEditor flags

Fixes #9356

Diffstat:
Mcreate/content.go | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git 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
 	}