ugrep icon indicating copy to clipboard operation
ugrep copied to clipboard

ugrep immediately breaks pipe with process substitution where grep, and ripgrep succeed

Open tsujp opened this issue 5 months ago • 2 comments

I am using process substitution here as I later want to kill the subprocess when the first match is found, but this occurs long before that kind of complexity is reached, what follows is a minimal reproduction.

With ripgrep

$ # ripgrep 14.1.1
$ rg foo <(sleep 1; echo 'foo'; sleep 1; echo 'foo'; sleep 1; echo 'done'; exit 10); echo $?
1:foo
2:foo
0

With grep

$ # grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
$ grep foo <(sleep 1; echo 'foo'; sleep 1; echo 'foo'; sleep 1; echo 'done'; exit 10); echo $?
foo
foo
0

With ugrep

$ # ugrep 7.5.0 aarch64-apple-darwin23.6.0; -P:pcre2jit; -z:zlib,bzip2,lzma,lz4,zstd,7z,tar/pax/cpio/zip
$ ugrep foo <(sleep 1; echo 'foo'; sleep 1; echo 'foo'; sleep 1; echo 'done'; exit 10); echo $?
1

ugrep appears to immediately close the pipe and abort.

tsujp avatar Jul 24 '25 11:07 tsujp

Any update regarding this?

sebaszv avatar Sep 25 '25 23:09 sebaszv

this works as expected

% echo abc | ugrep .
abc

but process substitution produces no results and ugrep's exit status is 1

% ugrep . <(echo abc)

dicktyr avatar Dec 03 '25 05:12 dicktyr