diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-12-01 01:39:56 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-12-01 01:40:42 +0900 |
commit | 85a75ee035f7945ecbb82e76fc5e1ca5e81993ae (patch) | |
tree | 271c6c2becda8519ec142a9a24f95c479d022c5d /src | |
parent | 1e5bd55672e92088504b0323669e9c120678d3c5 (diff) |
Revert default command: find with -fstype required
In #1061 we changed the default command to retry with a simpler find
command with fewer arguments if the first find command failed. This was
to support stripped-down verions of find that do not support -fstype
argument.
However, this caused an unwanted side-effect of yielding duplicate
entries when the first command failed after producing some lines.
We revert the change in this commit, so the default command will not
work with find without -fstype support. But we now print better error
message in that case so that the user can set up a working
$FZF_DEFAULT_COMMAND.
Close #1120 #1167
Diffstat (limited to 'src')
-rw-r--r-- | src/constants.go | 2 | ||||
-rw-r--r-- | src/terminal.go | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/constants.go b/src/constants.go index e6ed1702..8eddce9f 100644 --- a/src/constants.go +++ b/src/constants.go @@ -55,7 +55,7 @@ var defaultCommand string func init() { if !util.IsWindows() { - defaultCommand = `set -o pipefail; (command find -L . -mindepth 1 \( -path '*/\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune -o -type f -print -o -type l -print || command find -L . -mindepth 1 -path '*/\.*' -prune -o -type f -print -o -type l -print) 2> /dev/null | cut -b3-` + defaultCommand = `set -o pipefail; command find -L . -mindepth 1 \( -path '*/\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-` } else if os.Getenv("TERM") == "cygwin" { defaultCommand = `sh -c "command find -L . -mindepth 1 -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-"` } else { diff --git a/src/terminal.go b/src/terminal.go index 98d837c8..7dbdb6ec 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -691,7 +691,11 @@ func (t *Terminal) printInfo() { output += fmt.Sprintf(" (%d%%)", t.progress) } if !t.success && t.count == 0 { - output += " [ERROR]" + if len(os.Getenv("FZF_DEFAULT_COMMAND")) > 0 { + output = "[$FZF_DEFAULT_COMMAND failed]" + } else { + output = "[default command failed - $FZF_DEFAULT_COMMAND required]" + } } if pos+len(output) <= t.window.Width() { t.window.CPrint(tui.ColInfo, 0, output) |