Skip to content

Commit d48a98c

Browse files
bhavin192bep
authored andcommitted
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 <bhavin7392@gmail.com>
1 parent 3261678 commit d48a98c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

create/content.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ func NewContent(
105105
if editor != "" {
106106
jww.FEEDBACK.Printf("Editing %s with %q ...\n", targetPath, editor)
107107

108-
cmd := exec.Command(editor, contentPath)
108+
editorCmd := append(strings.Fields(editor), contentPath)
109+
cmd := exec.Command(editorCmd[0], editorCmd[1:]...)
109110
cmd.Stdin = os.Stdin
110111
cmd.Stdout = os.Stdout
111112
cmd.Stderr = os.Stderr

0 commit comments

Comments
 (0)