Skip to content

Fix fzf with no cmdline arguments on Cygwin #4383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

clarity20
Copy link

This addresses issue #4382.

In module src/winpty_windows.go, function runWinpty() is handing off the executable's full pathname to runProxy() as the first argument. The path was coming over Windows-style and causing Cygwin to choke. So I'm checking uname -s for Cygwin and calling cygpath to reformat if needed. Very basic test runs now looking good:

fzf test drive

@xrstf
Copy link

xrstf commented May 18, 2025

This PR makes fzf work in my Cygwin64 installation on Windows 10.

argStr := escapeSingleQuote(args[0])
_argStr := ""

osname, _ := exec.Command("uname", "-s").Output()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we would have to start a process to determine if we're running Cygwin, but this has a cost. Can there be a lighter way to do it, like checking if an environment variable exists?

Copy link
Author

@clarity20 clarity20 May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a good point. Based on their respective man pages, in bash and zsh we can check that os.Getenv("OSTYPE") == "cygwin", but fish makes no mention of OSTYPE and I don't see a better option than uname in that case. Perhaps that little complication can be ironed out by looking at opts.{Bash,Zsh,Fish}?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any environment variable that shows you're on Cygwin? Something like $CYGWIN or $CYG*?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants