create: Correctly pass newContentEditor flags
authorJoe Mooring <joe.mooring@veriphor.com>
Fri, 7 Jan 2022 05:19:13 +0000 (21:19 -0800)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 7 Jan 2022 09:46:32 +0000 (10:46 +0100)
Fixes #9356

create/content.go

index 6ae912882648cb3ce96359114dfacbc7c2384d57..400cff341fa02ceb9e3750c26542fb655479179d 100644 (file)
@@ -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
        }