m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

--tmux: Export bash functions

Fix #4001
This commit is contained in:
Junegunn Choi
2024-09-22 00:31:11 +09:00
parent 53bcdc4294
commit 4161403a1d
5 changed files with 50 additions and 23 deletions

View File

@@ -13,12 +13,16 @@ import (
var shPath atomic.Value
func sh() (string, error) {
func sh(bash bool) (string, error) {
if cached := shPath.Load(); cached != nil {
return cached.(string), nil
}
cmd := exec.Command("cygpath", "-w", "/usr/bin/sh")
name := "sh"
if bash {
name = "bash"
}
cmd := exec.Command("cygpath", "-w", "/usr/bin/"+name)
bytes, err := cmd.Output()
if err != nil {
return "", err
@@ -31,7 +35,7 @@ func sh() (string, error) {
func mkfifo(path string, mode uint32) (string, error) {
m := strconv.FormatUint(uint64(mode), 8)
sh, err := sh()
sh, err := sh(false)
if err != nil {
return path, err
}
@@ -43,7 +47,7 @@ func mkfifo(path string, mode uint32) (string, error) {
}
func withOutputPipe(output string, task func(io.ReadCloser)) error {
sh, err := sh()
sh, err := sh(false)
if err != nil {
return err
}
@@ -62,7 +66,7 @@ func withOutputPipe(output string, task func(io.ReadCloser)) error {
}
func withInputPipe(input string, task func(io.WriteCloser)) error {
sh, err := sh()
sh, err := sh(false)
if err != nil {
return err
}