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>
This commit is contained in:
Bhavin Gandhi 2020-10-15 20:53:48 +05:30 committed by Bjørn Erik Pedersen
parent 3261678f63
commit d48a98c477
1 changed files with 2 additions and 1 deletions

View File

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