-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Hangs when searching recursively under Cygwin #19
Comments
If you do I'm wondering if this is a dupe of #27. (I have run |
You're right, I still have trouble understanding what's going on with |
I have no clue. I can't think of any reason why the presence or absence of I will try to fire up a cygwin shell soon and see how rg behaves. |
TIA! If you'd like to use exactly the same data as I do for reproducing the problem, I'm running the command in a checkout of wxWidgets in 32 bit Cygwin zsh. |
Thank you so much for that tidbit. I've gotten so used to people running |
Seems like I have the same problem with a msys2 shell (the workaround works for me as well). |
For the folks on Windows, does |
Yes, it works normally in the Windows Command Prompt. It hangs in mintty. |
Ah! I can reproduce this, yay. The reason why I hadn't seen this before was because I was SSHing into my Windows VM. If I actually open the cygwin terminal and run FYI, it "hangs" because it's sitting waiting for stdin, so something is buggy in the tty detection. |
So it occurs to me that I have no clue how to determine whether something is being piped to I think what I'm going to do is switch the failure modes. That is, always assume |
Oh, sorry, I should have thought about this, this is actually a pretty well-known issue -- but without any good solution, unfortunately. The problem is that Windows doesn't have any concept of PTY, so when a program is running in any kind of terminal emulator, and not the standard console window, its stdin is always connected to a pipe, as far as Windows is concerned. Cygwin applications can distinguish between "real" pipes and normal input from the terminal, but I don't know of any way to do this without linking to I think you should still be able to detect whether stdin is a TTY when running inside the native console and you should be able to check for this (running inside console, I mean). But everything console-related in Windows is pretty hairy, just look at our own code for detecting whether we can write to a console... |
I've fixed this, but created a new bug in the process, under the premise that this bug is worse than #94. |
This means that `rg pat < file` won't do the expected thing and search `fil`. Instead, it will recursively search the current directory for `pat`. This isn't ideal, but is better than the previous behavior, which was to wait for stdin when running `rg pat`, given the appearance of hanging forever. The former is an important use case, but the latter is the *central* use case of ripgrep, so we should make that work. `rg` can still be used to search stdin on Windows, it just needs to be done explicitly. e.g., `rg pat - < file` will search for `pat` in `file`. Fixes BurntSushi#19
I think it might be better to revert this fix and instruct Cygwin users to compile from source using Of course, it'd also be an option to provide prebuilt Cygwin binaries to hopefully solve this. |
Could you please explain why, in detail that would fix this issue? Does it actually fix it for you? Having Obviously, we'd like both things to work. As I've stated, I don't know how to do that. Others have given me some threads to pull on, but I haven't had time to look into it. |
I'll try to build with the fix reverted, it's just a wild guess at this point. |
This is rather mysterious but the first thing I did after installing the Windows binary (
ripgrep-0.1.17-x86_64-pc-windows-msvc.zip
) was to runrg fun
from Cygwin shell inside a relatively big repository and it just hung without outputting anything. Trying to search inside a single file works fine, searching in a single leaf subdirectory does too, but searching under a subdirectory containing other subdirectories outputs a number of matches and then hangs on exit. To emphasize, this only happens in a Cygwin shell, the tool doesn't hang when run from the standard Windows DOS window.Looking at it in process explorer I see that the thread is completely stuck (0% CPU use) and the stack is
which doesn't make much sense to me, but maybe it can be useful to you if you have the map file and see what does
0x124f1f
offset correspond to.I could try debugging this further later, but unfortunately I really don't have time for this now, I just wanted to quickly check a promising new tool...
The text was updated successfully, but these errors were encountered: