Add --with-shell for shelling out with different command and flags (#3746)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #3732
authored by Junegunn Choi · committed by GitHub · parent b86a967 · Browse files · 13 files·+194 added−128 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
13 files+194 added−128 removed
- tests:+1 added−1 removed
- other:+193 added−127 removed
Provenance
- Commit
a4391ae- Tree
73a6862- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
b86a967
13 files changed+194 added−128 removed
modified:man/man1/fzf.1+12 added-2 removed
816 unmodified lines817 .RS818 e.g. \fBfzf --multi | fzf --sync\fR819 .RE820 .TP821+.B "--with-shell=STR"822+Shell command and flags to start child processes with. On *nix Systems, the823+default value is \fB$SHELL -c\fR if \fB$SHELL\fR is set, otherwise \fBsh -c\fR.824+On Windows, the default value is \fBcmd /v:on/s/c\fR when \fB$SHELL\fR is not825+set.826+827+.RS828+e.g. \fBgem list | fzf --with-shell 'ruby -e' --preview 'pp Gem::Specification.find_by_name({1})'\fR829+.RE830+.TP831 .B "--listen[=[ADDR:]PORT]" "--listen-unsafe[=[ADDR:]PORT]"832 Start HTTP server and listen on the given address. It allows external processes833 to send actions to perform via POST method.834 106 unmodified lines941 .BR 1 " No match"942 .br943 .BR 2 " Error"944 .br945+.BR 127 " Invalid shell command for \fBbecome\fR action"946+.br947 .BR 130 " Interrupted with \fBCTRL-C\fR or \fBESC\fR"948 949 .SH FIELD INDEX EXPRESSION950 501 unmodified lines1452 call.1453 1454 \fBfzf --bind "enter:become(vim {})"\fR1455 1444-\fBbecome(...)\fR is not supported on Windows.1445-1456 .SS RELOAD INPUT1457 1458 \fBreload(...)\fR action is used to dynamically update the input list1459 without restarting fzf. It takes the same command template with placeholder99 unmodified linesmodified:src/util/util_unix.go+48 added-8 removed
1 unmodified line2 3 package util4 5 import (6+ "fmt"7 "os"8 "os/exec"9+ "strings"10 "syscall"11 12 "golang.org/x/sys/unix"13 )14 13-// ExecCommand executes the given command with $SHELL14-func ExecCommand(command string, setpgid bool) *exec.Cmd {15+type Executor struct {16+ shell string17+ args []string18+ escaper *strings.Replacer19+}20+21+func NewExecutor(withShell string) *Executor {22 shell := os.Getenv("SHELL")23+ args := strings.Fields(withShell)24+ if len(args) > 0 {25+ shell = args[0]26+ args = args[1:]27+ } else {16- if len(shell) == 0 {17- shell = "sh"28+ if len(shell) == 0 {29+ shell = "sh"30+ }31+ args = []string{"-c"}32 }19- return ExecCommandWith(shell, command, setpgid)33+34+ var escaper *strings.Replacer35+ tokens := strings.Split(shell, "/")36+ if tokens[len(tokens)-1] == "fish" {37+ // https://fishshell.com/docs/current/language.html#quotes38+ // > The only meaningful escape sequences in single quotes are \', which39+ // > escapes a single quote and \\, which escapes the backslash symbol.40+ escaper = strings.NewReplacer("\\", "\\\\", "'", "\\'")41+ } else {42+ escaper = strings.NewReplacer("'", "'\\''")43+ }44+ return &Executor{shell, args, escaper}45 }46 22-// ExecCommandWith executes the given command with the specified shell23-func ExecCommandWith(shell string, command string, setpgid bool) *exec.Cmd {24- cmd := exec.Command(shell, "-c", command)47+// ExecCommand executes the given command with $SHELL48+func (x *Executor) ExecCommand(command string, setpgid bool) *exec.Cmd {49+ cmd := exec.Command(x.shell, append(x.args, command)...)50 if setpgid {51 cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}52 }53 return cmd54 }55 56+func (x *Executor) QuoteEntry(entry string) string {57+ return "'" + x.escaper.Replace(entry) + "'"58+}59+60+func (x *Executor) Become(stdin *os.File, environ []string, command string) {61+ shellPath, err := exec.LookPath(x.shell)62+ if err != nil {63+ fmt.Fprintf(os.Stderr, "fzf (become): %s\n", err.Error())64+ Exit(127)65+ }66+ args := append([]string{shellPath}, append(x.args, command)...)67+ SetStdin(stdin)68+ syscall.Exec(shellPath, args, environ)69+}70+71 // KillCommand kills the process for the given command72 func KillCommand(cmd *exec.Cmd) error {73 return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)74 }19 unmodified linesmodified:src/util/util_windows.go+74 added-32 removed
4 unmodified lines5 import (6 "fmt"7 "os"8 "os/exec"9+ "regexp"10 "strings"11 "sync/atomic"12 "syscall"13 )14 15+type Executor struct {16+ shell string17+ args []string14-var shellPath atomic.Value18+ shellPath atomic.Value19+}20 21+func NewExecutor(withShell string) *Executor {22+ shell := os.Getenv("SHELL")23+ args := strings.Fields(withShell)24+ if len(args) > 0 {25+ shell = args[0]26+ } else if len(shell) == 0 {27+ shell = "cmd"28+ }29+30+ if len(args) > 0 {31+ args = args[1:]32+ } else if strings.Contains(shell, "cmd") {33+ args = []string{"/v:on/s/c"}34+ } else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {35+ args = []string{"-NoProfile", "-Command"}36+ } else {37+ args = []string{"-c"}38+ }39+ return &Executor{shell: shell, args: args}40+}41+42 // ExecCommand executes the given command with $SHELL43+// FIXME: setpgid is unused. We set it in the Unix implementation so that we44+// can kill preview process with its child processes at once.45+// NOTE: For "powershell", we should ideally set output encoding to UTF8,46+// but it is left as is now because no adverse effect has been observed.17-func ExecCommand(command string, setpgid bool) *exec.Cmd {18- var shell string19- if cached := shellPath.Load(); cached != nil {47+func (x *Executor) ExecCommand(command string, setpgid bool) *exec.Cmd {48+ shell := x.shell49+ if cached := x.shellPath.Load(); cached != nil {50 shell = cached.(string)51 } else {22- shell = os.Getenv("SHELL")23- if len(shell) == 0 {24- shell = "cmd"25- } else if strings.Contains(shell, "/") {52+ if strings.Contains(shell, "/") {53 out, err := exec.Command("cygpath", "-w", shell).Output()54 if err == nil {55 shell = strings.Trim(string(out), "\n")56 }57 }31- shellPath.Store(shell)58+ x.shellPath.Store(shell)59 }33- return ExecCommandWith(shell, command, setpgid)60+ cmd := exec.Command(shell, append(x.args, command)...)61+ cmd.SysProcAttr = &syscall.SysProcAttr{62+ HideWindow: false,63+ CreationFlags: 0,64+ }65+ return cmd66 }67 36-// ExecCommandWith executes the given command with the specified shell37-// FIXME: setpgid is unused. We set it in the Unix implementation so that we38-// can kill preview process with its child processes at once.39-// NOTE: For "powershell", we should ideally set output encoding to UTF8,40-// but it is left as is now because no adverse effect has been observed.41-func ExecCommandWith(shell string, command string, setpgid bool) *exec.Cmd {42- var cmd *exec.Cmd43- if strings.Contains(shell, "cmd") {44- cmd = exec.Command(shell)45- cmd.SysProcAttr = &syscall.SysProcAttr{46- HideWindow: false,47- CmdLine: fmt.Sprintf(` /v:on/s/c "%s"`, command),48- CreationFlags: 0,68+func (x *Executor) Become(stdin *os.File, environ []string, command string) {69+ cmd := x.ExecCommand(command, false)70+ cmd.Stdin = stdin71+ cmd.Stdout = os.Stdout72+ cmd.Stderr = os.Stderr73+ cmd.Env = environ74+ err := cmd.Start()75+ if err != nil {76+ fmt.Fprintf(os.Stderr, "fzf (become): %s\n", err.Error())77+ Exit(127)78+ }79+ err = cmd.Wait()80+ if err != nil {81+ if exitError, ok := err.(*exec.ExitError); ok {82+ Exit(exitError.ExitCode())83 }50- return cmd84 }85+ Exit(0)86+}87 53- if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {54- cmd = exec.Command(shell, "-NoProfile", "-Command", command)88+func (x *Executor) QuoteEntry(entry string) string {89+ if strings.Contains(x.shell, "cmd") {90+ // backslash escaping is done here for applications91+ // (see ripgrep test case in terminal_test.go#TestWindowsCommands)92+ escaped := strings.Replace(entry, `\`, `\\`, -1)93+ escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`94+ // caret is the escape character for cmd shell95+ r, _ := regexp.Compile(`[&|<>()@^%!"]`)96+ return r.ReplaceAllStringFunc(escaped, func(match string) string {97+ return "^" + match98+ })99+ } else if strings.Contains(x.shell, "pwsh") || strings.Contains(x.shell, "powershell") {100+ escaped := strings.Replace(entry, `"`, `\"`, -1)101+ return "'" + strings.Replace(escaped, "'", "''", -1) + "'"102 } else {56- cmd = exec.Command(shell, "-c", command)103+ return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"104 }58- cmd.SysProcAttr = &syscall.SysProcAttr{59- HideWindow: false,60- CreationFlags: 0,61- }62- return cmd105 }106 107 // KillCommand kills the process for the given command108 func KillCommand(cmd *exec.Cmd) error {21 unmodified linesmodified:src/core.go+6 added-3 removed
119 unmodified lines120 return true121 })122 }123 124+ // Process executor125+ executor := util.NewExecutor(opts.WithShell)126+127 // Reader128 streamingFilter := opts.Filter != nil && !sort && !opts.Tac && !opts.Sync129 var reader *Reader130 if !streamingFilter {131 reader = NewReader(func(data []byte) bool {132 return chunkList.Push(data)130- }, eventBox, opts.ReadZero, opts.Filter == nil)133+ }, eventBox, executor, opts.ReadZero, opts.Filter == nil)134 go reader.ReadSource(opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip)135 }136 137 // Matcher42 unmodified lines180 }181 mutex.Unlock()182 }183 return false181- }, eventBox, opts.ReadZero, false)184+ }, eventBox, executor, opts.ReadZero, false)185 reader.ReadSource(opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip)186 } else {187 eventBox.Unwatch(EvtReadNew)188 eventBox.WaitFor(EvtReadFin)22 unmodified lines211 // Go interactive212 go matcher.Loop()213 214 // Terminal I/O212- terminal := NewTerminal(opts, eventBox)215+ terminal := NewTerminal(opts, eventBox, executor)216 maxFit := 0 // Maximum number of items that can fit on screen217 padHeight := 0218 heightUnknown := opts.Height.auto219 if heightUnknown {183 unmodified linesmodified:src/options.go+6 added-4 removed
118 unmodified lines119 --expect=KEYS Comma-separated list of keys to complete fzf120 --read0 Read input delimited by ASCII NUL characters121 --print0 Print output delimited by ASCII NUL characters122 --sync Synchronous search for multi-staged filtering123+ --with-shell=STR Shell command and flags to start child processes with124 --listen[=[ADDR:]PORT] Start HTTP server to receive actions (POST /)125 (To allow remote process execution, use --listen-unsafe)126 --version Display version information and exit127 228 unmodified lines356 PreviewLabel labelOpts357 Unicode bool358 Ambidouble bool359 Tabstop int360+ WithShell string361 ListenAddr *listenAddress362 Unsafe bool363 ClearOnExit bool364 WalkerOpts walkerOpts963 unmodified lines1328 actionArg = spec[offset+1 : len(spec)-1]1329 actions = append(actions, &action{t: t, a: actionArg})1330 }1331 switch t {1330- case actBecome:1331- if util.IsWindows() {1332- exit("become action is not supported on Windows")1333- }1332 case actUnbind, actRebind:1333 parseKeyChordsImpl(actionArg, spec[0:offset]+" target required", exit)1334 case actChangePreviewWindow:1335 opts := previewOpts{}618 unmodified lines1954 "padding",1955 nextString(allArgs, &i, "padding required (TRBL / TB,RL / T,RL,B / T,R,B,L)"))1956 case "--tabstop":1957 opts.Tabstop = nextInt(allArgs, &i, "tab stop required")1958+ case "--with-shell":1959+ opts.WithShell = nextString(allArgs, &i, "shell command and flags required")1960 case "--listen", "--listen-unsafe":1961 given, str := optionalNextString(allArgs, &i)1962 addr := defaultListenAddr1963 if given {108 unmodified lines2072 } else if match, value := optString(arg, "--padding="); match {2073 opts.Padding = parseMargin("padding", value)2074 } else if match, value := optString(arg, "--tabstop="); match {2075 opts.Tabstop = atoi(value)2076+ } else if match, value := optString(arg, "--with-shell="); match {2077+ opts.WithShell = value2078 } else if match, value := optString(arg, "--listen="); match {2079 addr, err := parseListenAddress(value)2080 if err != nil {2081 errorExit(err.Error())246 unmodified linesmodified:src/reader_test.go+2 added-1 removed
8 unmodified lines9 10 func TestReadFromCommand(t *testing.T) {11 strs := []string{}12 eb := util.NewEventBox()13+ exec := util.NewExecutor("")14 reader := NewReader(15 func(s []byte) bool { strs = append(strs, string(s)); return true },15- eb, false, true)16+ eb, exec, false, true)17 18 reader.startEventPoller()19 20 // Check EventBox44 unmodified linesmodified:src/reader.go+4 added-3 removed
16 unmodified lines17 18 // Reader reads from command or standard input19 type Reader struct {20 pusher func([]byte) bool21+ executor *util.Executor22 eventBox *util.EventBox23 delimNil bool24 event int3225 finChan chan bool4 unmodified lines30 wait bool31 }32 33 // NewReader returns new Reader object33-func NewReader(pusher func([]byte) bool, eventBox *util.EventBox, delimNil bool, wait bool) *Reader {34- return &Reader{pusher, eventBox, delimNil, int32(EvtReady), make(chan bool, 1), sync.Mutex{}, nil, nil, false, wait}34+func NewReader(pusher func([]byte) bool, eventBox *util.EventBox, executor *util.Executor, delimNil bool, wait bool) *Reader {35+ return &Reader{pusher, executor, eventBox, delimNil, int32(EvtReady), make(chan bool, 1), sync.Mutex{}, nil, nil, false, wait}36 }37 38 func (r *Reader) startEventPoller() {39 go func() {202 unmodified lines242 func (r *Reader) readFromCommand(command string, environ []string) bool {243 r.mutex.Lock()244 r.killed = false245 r.command = &command245- r.exec = util.ExecCommand(command, true)246+ r.exec = r.executor.ExecCommand(command, true)247 if environ != nil {248 r.exec.Env = environ249 }250 out, err := r.exec.StdoutPipe()12 unmodified linesmodified:src/terminal_test.go+3 added-1 removed
21 unmodified lines22 query: query,23 allItems: allItems,24 lastAction: actBackwardDeleteCharEof,25 prompt: "prompt",26+ executor: util.NewExecutor(""),27 })28 }29 30 func TestReplacePlaceholder(t *testing.T) {213 unmodified lines244 type quotes struct{ E, O, SQ, DQ, BS string } // standalone escape, outer, single and double quotes, backslash245 unixStyle := quotes{``, `'`, `'\''`, `"`, `\`}246 windowsStyle := quotes{`^`, `^"`, `'`, `\^"`, `\\`}247 var effectiveStyle quotes248+ exec := util.NewExecutor("")249 250 if util.IsWindows() {251 effectiveStyle = windowsStyle252 } else {26 unmodified lines279 `"C:\Program Files"`: `{{.O}}{{.DQ}}C:{{.BS}}Program Files{{.DQ}}{{.O}}`,280 }281 282 for input, expected := range tests {281- escaped := quoteEntry(input)283+ escaped := exec.QuoteEntry(input)284 expected = templateToString(expected, effectiveStyle)285 if escaped != expected {286 t.Errorf("Input: %s, expected: %s, actual %s", input, expected, escaped)287 }371 unmodified linesmodified:src/terminal_unix.go-19 removed
3 unmodified lines4 5 import (6 "os"7 "os/signal"8- "strings"8 "syscall"9 10 "golang.org/x/sys/unix"11 )12 14-var escaper *strings.Replacer15-16-func init() {17- tokens := strings.Split(os.Getenv("SHELL"), "/")18- if tokens[len(tokens)-1] == "fish" {19- // https://fishshell.com/docs/current/language.html#quotes20- // > The only meaningful escape sequences in single quotes are \', which21- // > escapes a single quote and \\, which escapes the backslash symbol.22- escaper = strings.NewReplacer("\\", "\\\\", "'", "\\'")23- } else {24- escaper = strings.NewReplacer("'", "'\\''")25- }26-}27-13 func notifyOnResize(resizeChan chan<- os.Signal) {14 signal.Notify(resizeChan, syscall.SIGWINCH)15 }16 8 unmodified lines25 26 func notifyOnCont(resizeChan chan<- os.Signal) {27 signal.Notify(resizeChan, syscall.SIGCONT)28 }44-45-func quoteEntry(entry string) string {46- return "'" + escaper.Replace(entry) + "'"47-}modified:src/terminal_windows.go-26 removed
2 unmodified lines3 package fzf4 5 import (6 "os"7- "regexp"8- "strings"7 )8 9 func notifyOnResize(resizeChan chan<- os.Signal) {10 // TODO5 unmodified lines16 17 func notifyOnCont(resizeChan chan<- os.Signal) {18 // NOOP19 }22-23-func quoteEntry(entry string) string {24- shell := os.Getenv("SHELL")25- if len(shell) == 0 {26- shell = "cmd"27- }28-29- if strings.Contains(shell, "cmd") {30- // backslash escaping is done here for applications31- // (see ripgrep test case in terminal_test.go#TestWindowsCommands)32- escaped := strings.Replace(entry, `\`, `\\`, -1)33- escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`34- // caret is the escape character for cmd shell35- r, _ := regexp.Compile(`[&|<>()@^%!"]`)36- return r.ReplaceAllStringFunc(escaped, func(match string) string {37- return "^" + match38- })39- } else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {40- escaped := strings.Replace(entry, `"`, `\"`, -1)41- return "'" + strings.Replace(escaped, "'", "''", -1) + "'"42- } else {43- return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"44- }45-}modified:src/terminal.go+25 added-28 removed
5 unmodified lines6 "fmt"7 "io"8 "math"9 "os"10- "os/exec"10 "os/signal"11 "regexp"12 "sort"13 "strconv"229 unmodified lines243 listenPort *int244 listenUnsafe bool245 borderShape tui.BorderShape246 cleanExit bool247+ executor *util.Executor248 paused bool249 border tui.Window250 window tui.Window251 pborder tui.Window387 unmodified lines639 return int(size)640 }641 642 // NewTerminal returns new Terminal object643-func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {643+func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor) *Terminal {644 input := trimQuery(opts.Query)645 var delay time.Duration646 if opts.Tac {647 delay = initialDelayTac87 unmodified lines735 borderLabelOpts: opts.BorderLabel,736 previewLabel: nil,737 previewLabelOpts: opts.PreviewLabel,738 cleanExit: opts.ClearOnExit,739+ executor: executor,740 paused: opts.Phony,741 cycle: opts.Cycle,742 headerVisible: true,743 headerFirst: opts.HeaderFirst,1778 unmodified lines2522 query string2523 allItems []*Item2524 lastAction actionType2525 prompt string2526+ executor *util.Executor2527 }2528 2529 func (t *Terminal) replacePlaceholder(template string, forcePlus bool, input string, list []*Item) string {2530 return replacePlaceholder(replacePlaceholderParams{5 unmodified lines2536 query: input,2537 allItems: list,2538 lastAction: t.lastAction,2539 prompt: t.promptString,2540+ executor: t.executor,2541 })2542 }2543 2544 func (t *Terminal) evaluateScrollOffset() int {52 unmodified lines2597 switch {2598 case escaped:2599 return match2600 case match == "{q}" || match == "{fzf:query}":2598- return quoteEntry(params.query)2601+ return params.executor.QuoteEntry(params.query)2602 case match == "{}":2603 replace = func(item *Item) string {2604 switch {2605 case flags.number:4 unmodified lines2610 return strconv.Itoa(n)2611 case flags.file:2612 return item.AsString(params.stripAnsi)2613 default:2611- return quoteEntry(item.AsString(params.stripAnsi))2614+ return params.executor.QuoteEntry(item.AsString(params.stripAnsi))2615 }2616 }2617 case match == "{fzf:action}":2618 return params.lastAction.Name()2619 case match == "{fzf:prompt}":2617- return quoteEntry(params.prompt)2620+ return params.executor.QuoteEntry(params.prompt)2621 default:2622 // token type and also failover (below)2623 rangeExpressions := strings.Split(match[1:len(match)-1], ",")2624 ranges := make([]Range, len(rangeExpressions))25 unmodified lines2650 if !flags.preserveSpace {2651 str = strings.TrimSpace(str)2652 }2653 if !flags.file {2651- str = quoteEntry(str)2654+ str = params.executor.QuoteEntry(str)2655 }2656 return str2657 }2658 }31 unmodified lines2690 if !valid && !capture {2691 return line2692 }2693 command := t.replacePlaceholder(template, forcePlus, string(t.input), list)2691- cmd := util.ExecCommand(command, false)2694+ cmd := t.executor.ExecCommand(command, false)2695 cmd.Env = t.environ()2696 t.executing.Set(true)2697 if !background {2698 cmd.Stdin = tui.TtyIn()268 unmodified lines2967 // We don't display preview window if no match2968 if items[0] != nil {2969 _, query := t.Input()2970 command := t.replacePlaceholder(commandTemplate, false, string(query), items)2968- cmd := util.ExecCommand(command, true)2971+ cmd := t.executor.ExecCommand(command, true)2972 env := t.environ()2973 if pwindowSize.Lines > 0 {2974 lines := fmt.Sprintf("LINES=%d", pwindowSize.Lines)2975 columns := fmt.Sprintf("COLUMNS=%d", pwindowSize.Columns)398 unmodified lines3374 case actBecome:3375 valid, list := t.buildPlusList(a.a, false)3376 if valid {3377 command := t.replacePlaceholder(a.a, false, string(t.input), list)3375- shell := os.Getenv("SHELL")3376- if len(shell) == 0 {3377- shell = "sh"3378+ t.tui.Close()3379+ if t.history != nil {3380+ t.history.append(string(t.input))3381 }3379- shellPath, err := exec.LookPath(shell)3380- if err == nil {3381- t.tui.Close()3382- if t.history != nil {3383- t.history.append(string(t.input))3384- }3385- /*3386- FIXME: It is not at all clear why this is required.3387- The following command will report 'not a tty', unless we open3388- /dev/tty *twice* after closing the standard input for 'reload'3389- in Reader.terminate().3390- : | fzf --bind 'start:reload:ls' --bind 'enter:become:tty'3391- */3392- tui.TtyIn()3393- util.SetStdin(tui.TtyIn())3394- syscall.Exec(shellPath, []string{shell, "-c", command}, os.Environ())3395- }3382+3383+ /*3384+ FIXME: It is not at all clear why this is required.3385+ The following command will report 'not a tty', unless we open3386+ /dev/tty *twice* after closing the standard input for 'reload'3387+ in Reader.terminate().3388+3389+ while : | fzf --bind 'start:reload:ls' --bind 'load:become:tty'; do echo; done3390+ */3391+ tui.TtyIn()3392+ t.executor.Become(tui.TtyIn(), t.environ(), command)3393 }3394 case actExecute, actExecuteSilent:3395 t.executeCommand(a.a, false, a.t == actExecuteSilent, false, false)3396 case actExecuteMulti:895 unmodified linesmodified:test/test_go.rb+1 added-1 removed
1972 unmodified lines1973 tmux.send_keys :Space1974 tmux.until { |lines| assert_equal 10, lines.item_count }1975 end1976 1977- def test_reload_should_terminate_stadard_input_stream1977+ def test_reload_should_terminate_standard_input_stream1978 tmux.send_keys %(ruby -e "STDOUT.sync = true; loop { puts 1; sleep 0.1 }" | fzf --bind 'start:reload(seq 100)'), :Enter1979 tmux.until { |lines| assert_equal 100, lines.item_count }1980 end1981 1791 unmodified linesmodified:CHANGELOG.md+13 added
1 unmodified line2 =========3 4 0.51.05 ------6+- Added `--with-shell` option to start child processes with a custom shell command and flags7+ ```sh8+ gem list | fzf --with-shell 'ruby -e' \9+ --preview 'pp Gem::Specification.find_by_name({1})' \10+ --bind 'ctrl-o:execute-silent:11+ spec = Gem::Specification.find_by_name({1})12+ [spec.homepage, *spec.metadata.filter { _1.end_with?("uri") }.values].uniq.each do13+ system "open", _114+ end15+ '16+ ```17 - Added `change-multi` action for dynamically changing `--multi` option18 - `change-multi` - enable multi-select mode with no limit19 - `change-multi(NUM)` - enable multi-select mode with a limit20 - `change-multi(0)` - disable multi-select mode21+- `become` action is now supported on Windows22+ - Unlike in *nix, this does not use `execve(2)`. Instead it spawns a new process and waits for it to finish, so the exact behavior may differ.23 - Bug fixes and improvements24 25 0.50.026 ------2013 unmodified lines