abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.3k stars 338 forks source link

counsel-rg doesn't display partial results if rg exits with error code #2339

Open Ruin0x11 opened 4 years ago

Ruin0x11 commented 4 years ago

If rg called by counsel-rg returns an error code, it will discard any incremental results it found and display Error code 2 instead, even if it found matches for files it did have access to.

This usually happens if some of the files in the rg directory cannot be accessed by rg because of permissions issues on some subset of the files. However I can still use rg on the console and get a list of valid results anyways (interspersed with error messages). You can even see these incremental results in counsel-rg so long as it's still searching, but it discards them all when it finishes because of the error. Now a single unreadable file in the entire project can render counsel-rg inoperable.

abo-abo commented 4 years ago

I tested with the following:

counsel-rg returns results for the second file, while for the first file, a single Permission denied (os error 13) is shown.

This behavior seems correct to me.

Ruin0x11 commented 4 years ago

This is my setup:

demo

Alexander-Shukaev commented 4 years ago

Some fancy additional flags you want to tell us about? Post the corresponding rg ... invocation as well please.

Ruin0x11 commented 4 years ago

counsel-rg-base-command is "rg --with-filename --no-heading --line-number --color never %s .", if that's what you mean.

When I run rg standalone from cmd, this is the output:

C:\Users\kuzuki\build\test>rg HOP3_at
./zxc: アクセスが拒否されました。 (os error 5)
source.hsp
8204:   goto *HOP3_at
8234:*HOP3_at

I don't have RIPGREP_CONFIG_PATH set in my environment.