Skip to content
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

Does --quiet --files actually terminate immediately? #907

Closed
roblourens opened this issue May 3, 2018 · 1 comment
Closed

Does --quiet --files actually terminate immediately? #907

roblourens opened this issue May 3, 2018 · 1 comment
Labels
doc An issue with or an improvement to documentation. enhancement An enhancement to the functionality of the software.

Comments

@roblourens
Copy link
Contributor

VS Code is using a command like rg --quiet --files -g '**/package.json' to test whether a workspace contains a certain type of file. Investigating microsoft/vscode#48599, it seems like ripgrep doesn't actually terminate early when the --quiet flag is used.

One way I'm testing this, in the ripgrep repo:


$ rg --quiet --files --debug 2> quiet.txt
$ rg --files --debug 2> notquiet.txt
$ ls -l quiet.txt
-rw-r--r--  1 roblou  staff  18067 May  2 20:22 quiet.txt
$ ls -l notquiet.txt
-rw-r--r--  1 roblou  staff  18067 May  2 20:22 notquiet.txt

I'd expect the --quiet version to terminate immediately after one file is found, and leave a shorter log behind.

In the original issue, rg runs for a long time despite the debug log showing that it saw a package.json file very early.

@BurntSushi
Copy link
Owner

The docs for --quiet say that if a match is found in a file, then ripgrep will stop searching. But if no match is found, then it continues. So with respect to the docs, the behavior you're inquiring about is unspecified, since the --files flag doesn't actually do any searching.

With that said, it seems like this is definitely a reasonable interpretation and use of --files. :-)

@BurntSushi BurntSushi added enhancement An enhancement to the functionality of the software. doc An issue with or an improvement to documentation. labels May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc An issue with or an improvement to documentation. enhancement An enhancement to the functionality of the software.
Projects
None yet
Development

No branches or pull requests

2 participants