#602
rg numbers lines by default even when its output is piped, and -g brace globs match nothing
just-bash version
3.6.0
Reproduction
cd /w
printf 'a\nb\n' | rg b
rg --files . | rg cls
rg -l -g '*.{cls,xml}' . .; echo "rc=$?"How you run it
import { Bash } from "just-bash";
const bash = new Bash({ files: { "/w/b.cls": "public class B {}\n", "/w/c.xml": "<x>Active</x>\n" } });
const result = await bash.exec(script);Expected behavior
ripgrep 15.2.0, with its output going to a pipe or file rather than a terminal:
b
./b.cls
./b.cls
./c.xml
rc=0Actual behavior
2:b
1:b.cls
rc=1Two separate things:
- Line numbers. ripgrep only turns on
--line-numberby default when stdout is a terminal.exec()output never is, so anything that pipes rg into another rg,xargsorsedgetsN:prefixes where it expects plain lines or paths. Our agent hit this in 13 piped rg calls in one eval run. The README calls out smart case as a deliberate difference from ripgrep, but not line numbers. If the terminal-style default is intentional, an option to turn it off would work for us too. - Brace globs. ripgrep's globs support
{a,b}, butmatchGlobinrg-search.tsescapes the braces, so-g '*.{cls,xml}'matches nothing and rg exits 1. Passing-g '*.cls' -g '*.xml'works. Both brace-glob searches our agent tried came back empty.
On main (9ab0e0d), lineNumber still defaults to true in rg-options.ts, and matchGlob still has no brace handling.
Environment
- Runtime (Node, Bun, browser, CLI): Node
- Runtime version: 26.8.2
- Operating system: macOS 15
- Bundler or framework, when relevant: none
Activity
0No activity yet.