create: Correctly pass newContentEditor flags

Fixes #9356
This commit is contained in:
Joe Mooring 2022-01-06 21:19:13 -08:00 committed by Bjørn Erik Pedersen
parent c8b5ab75b7
commit 0aca99fe01

View file

@ -343,15 +343,24 @@ func (b *contentBuilder) openInEditorIfConfigured(filename string) error {
return nil return nil
} }
b.h.Log.Printf("Editing %q with %q ...\n", filename, editor) editorExec := strings.Fields(editor)[0]
cmd, err := b.h.Deps.ExecHelper.New( editorFlags := strings.Fields(editor)[1:]
editor,
var args []interface{}
for _, editorFlag := range editorFlags {
args = append(args, editorFlag)
}
args = append(
args,
filename, filename,
hexec.WithStdin(os.Stdin), hexec.WithStdin(os.Stdin),
hexec.WithStderr(os.Stderr), hexec.WithStderr(os.Stderr),
hexec.WithStdout(os.Stdout), 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 { if err != nil {
return err return err
} }