Skip to content

Commit

Permalink
create: Pass editor arguments from newContentEditor correctly
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bhavin192 authored and bep committed Oct 24, 2020
1 parent 3261678 commit d48a98c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion create/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d48a98c

Please sign in to comment.