[Cygwin] command not found when using Windows binary and not providing command argument
Checklist
- [X] I have read through the manual page (
man fzf) - [X] I have searched through the existing issues
- [X] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
Output of fzf --version
0.56.3 (add1aec)
OS
- [ ] Linux
- [ ] macOS
- [X] Windows
- [x] Cygwin
- [ ] Etc.
Shell
- [X] bash
- [ ] zsh
- [ ] fish
Problem / Steps to reproduce
I have installed the Windows binary into C:\bin\fzf.exe, which is in my Cygwin path.
I have included the line eval "$(fzf --bash)" into my .bashrc.
I open Cygwin shell, no errors.
I hit [CTRL]+R, I get an error that make no sense:
C:\cygwin64\tmp\fzf-temp-3974864139: line 1: C:\bin\fzf.exe: command not found
If I run from bash fzf I get the same error.
If I run from bash fzf --help (or any other option) Fzf seem to work with no error.
It only breaks when given no argument!
PS. There is no recent version for fzf package. Do not use Cygwin package!
export MSYS=enable_pcon works for me on Cygwin.
Source: https://github.com/junegunn/fzf/wiki/Cygwin
@AnabasisXu Oh man, I didn't see this comment until now! Indeed, after hours of not understanding what happened, I tried your comment and it worked instantly.
What the hex is that MSYS=enable_pcon doing anyway?
Looking at the issue links from you wiki URL:
- #3809 and comment:
- https://github.com/junegunn/fzf/issues/3809#issuecomment-2126330368
When interacting with programs that use a native Windows API for command-line user interaction (“console mode”), a number of undesirable effects used to be observed; this is the https://github.com/mintty/mintty/issues/56 and the https://github.com/mintty/mintty/issues/376. This would basically affect all programs not compiled in a cygwin or msys environment (and note that MinGW is not msys in this context), and would occur in all pty-based terminals (like xterm, rxvt etc).
Cygwin 3.1.0compensates for this issue via the ConPTY API of Windows 10. On MSYS2, its usage can be enabled by setting the environment variableMSYS=enable_pcon(or selecting this setting when installing an older version). You can also later set MSYS=enable_pcon in file /etc/git-bash.config. MSYS2 releases since 2022-10-28 enable ConPTY by default. You can also set mintty option ConPTY=true to override the MSYS2 setting.
Thus in your ~/.bashrc:
# Add this:
export MSYS=enable_pcon
# Before this:
eval "$(fzf --bash)"