Skip to content
Myr

Fix --with-shell not handling quoted arguments correctly

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #4709 Use go-shellwords instead of strings.Fields to parse --with-shell, so paths with spaces can be properly quoted. ln -s /bin/bash "/tmp/ba sh" fzf --with-shell='/tmp/ba\ sh -c' --preview 'echo hello world' fzf --with-shell='"/tmp/ba sh" -c' --preview 'echo hello world'

authored by Junegunn Choi · committed by Junegunn Choi · parent f3ca0b1 · Browse files · 2 files+4 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−2 removed

  • other:+4 added−2 removed

2 files+4 added−2 removed

modified:src/util/util_unix.go+3 added-2 removed
7 unmodified lines
8 "os/exec"9 "strings"10 "syscall"1112 "github.com/junegunn/go-shellwords"13 "golang.org/x/sys/unix"14)1516type Executor struct {
3 unmodified lines
20}2122func NewExecutor(withShell string) *Executor {23 shell := os.Getenv("SHELL")23 args := strings.Fields(withShell)24 if len(args) > 0 {24 args, err := shellwords.Parse(withShell)25 if err == nil && len(args) > 0 {26 shell = args[0]27 args = args[1:]28 } else {29 if len(shell) == 0 {
65 unmodified lines
modified:CHANGELOG.md+1 added
18 unmodified lines
19- Bug fixes20 - Fixed AWK tokenizer not treating a new line character as whitespace21 - Fixed `--{accept,with}-nth` removing trailing whitespaces with a non-default `--delimiter`22 - Fixed OSC8 hyperlinks being mangled when the URL contains unicode characters (#4707)23 - Fixed `--with-shell` not handling quoted arguments correctly (#4709)24250.70.026------27- Added `change-with-nth` action for dynamically changing the `--with-nth` option.
3203 unmodified lines