From: Bhavin Gandhi Date: Thu, 15 Oct 2020 15:23:48 +0000 (+0530) Subject: create: Pass editor arguments from newContentEditor correctly X-Git-Tag: v0.77.0~12 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d48a98c477a818d28008d9771050d2681e63e880;p=brevno-suite%2Fhugo create: Pass editor arguments from newContentEditor correctly If newContentEditor has editor name with arguments like `emacsclient -n`, it fails with `executable file not found in $PATH`. This change parses the value correctly and passes it to the given editor. Signed-off-by: Bhavin Gandhi --- diff --git a/create/content.go b/create/content.go index 0e05adf9..13e66820 100644 --- a/create/content.go +++ b/create/content.go @@ -105,7 +105,8 @@ func NewContent( if editor != "" { jww.FEEDBACK.Printf("Editing %s with %q ...\n", targetPath, editor) - cmd := exec.Command(editor, contentPath) + editorCmd := append(strings.Fields(editor), contentPath) + cmd := exec.Command(editorCmd[0], editorCmd[1:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr