From ee40212e9772941b49a4bdb1e95f99913cdea469 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 28 Sep 2017 23:05:02 +0900 Subject: Update FZF_DEFAULT_COMMAND - Use bash for `set -o pipefail` - Fall back to simpler find command when the original command failed Related: #1061 --- src/util/util_unix.go | 5 +++++ src/util/util_windows.go | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/util') diff --git a/src/util/util_unix.go b/src/util/util_unix.go index d538ee00..fc63c027 100644 --- a/src/util/util_unix.go +++ b/src/util/util_unix.go @@ -14,6 +14,11 @@ func ExecCommand(command string) *exec.Cmd { if len(shell) == 0 { shell = "sh" } + return ExecCommandWith(shell, command) +} + +// ExecCommandWith executes the given command with the specified shell +func ExecCommandWith(shell string, command string) *exec.Cmd { return exec.Command(shell, "-c", command) } diff --git a/src/util/util_windows.go b/src/util/util_windows.go index efd19a2a..493f4d7f 100644 --- a/src/util/util_windows.go +++ b/src/util/util_windows.go @@ -10,8 +10,14 @@ import ( "github.com/mattn/go-shellwords" ) -// ExecCommand executes the given command with $SHELL +// ExecCommand executes the given command with cmd func ExecCommand(command string) *exec.Cmd { + return ExecCommandWith("cmd", command) +} + +// ExecCommandWith executes the given command with cmd. _shell parameter is +// ignored on Windows. +func ExecCommandWith(_shell string, command string) *exec.Cmd { args, _ := shellwords.Parse(command) allArgs := make([]string, len(args)+1) allArgs[0] = "/c" -- cgit v1.2.3