From e21be145b52dbf41faa79ffa6a58047eadc5f37f Mon Sep 17 00:00:00 2001 From: Takashi Fujita Date: Tue, 15 Sep 2020 15:54:16 +0900 Subject: [PATCH 1/2] fix to pass EDITOR command with args --- cmd/mmv/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/mmv/main.go b/cmd/mmv/main.go index 0e8fde2..54b7a03 100644 --- a/cmd/mmv/main.go +++ b/cmd/mmv/main.go @@ -100,7 +100,11 @@ func rename(args []string) error { return err } defer tty.Close() - cmd := exec.Command(editor, f.Name()) + + editorWithArgs := strings.Split(editor, " ") + editorWithArgs = append(editorWithArgs, f.Name()) + + cmd := exec.Command(editorWithArgs[0], editorWithArgs[1:]...) cmd.Stdin = tty.Input() cmd.Stdout = tty.Output() cmd.Stderr = tty.Output() From fce83774d264d701780c653618290659f5ed323c Mon Sep 17 00:00:00 2001 From: Takashi Fujita Date: Fri, 18 Sep 2020 19:40:02 +0900 Subject: [PATCH 2/2] fix to use strings.Fields to split --- cmd/mmv/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/mmv/main.go b/cmd/mmv/main.go index 54b7a03..4abd900 100644 --- a/cmd/mmv/main.go +++ b/cmd/mmv/main.go @@ -101,7 +101,7 @@ func rename(args []string) error { } defer tty.Close() - editorWithArgs := strings.Split(editor, " ") + editorWithArgs := strings.Fields(editor) editorWithArgs = append(editorWithArgs, f.Name()) cmd := exec.Command(editorWithArgs[0], editorWithArgs[1:]...)