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
}
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
}