Closed dvdksn closed 2 hours ago
It's likely because whatever is responsible for running ripgrep is advertising a readable stdin. You should be able to clearly see this given the --debug
messages you're getting:
#8 0.099 rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1099: using heuristics to determine whether to read from stdin or search ./ (is_readable_stdin=true, stdin_consumed=false, mode=Search(Standard))
#8 0.099 rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1112: heuristic chose to search stdin
And also from the man page:
ripgrep will automatically detect if stdin exists and search
stdin for a regex pattern, e.g. ls | rg foo. In some environ‐
ments, stdin may exist when it shouldn't. To turn off stdin de‐
tection, one can explicitly specify the directory to search,
e.g. rg foo ./.
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
Tested with: ripgrep 13.0.0 (Debian) ripgrep 14.1.0 (Alpine Linux)
How did you install ripgrep?
apk add ripgrep
apt install ripgrep
What operating system are you using ripgrep on?
Debian 12, Alpine Linux 3.20.3 (both in Docker)
Describe your bug.
rg
runs fine without a path argument if you do it interactively. But for some reason, when I try to runrg
in a Docker build, it would always error out unless I specify the positional argument for[PATH]
.The following interactive use case works fine:
alpine
container (with workdir/etc
in this case)What are the steps to reproduce the behavior?
Run the same steps as above but via a Dockerfile, you'll get an error.
What is the actual behavior?
What is the expected behavior?
I didn't expect the
[PATH]
argument to be necessary if I want to query the CWD.Running the same
docker build
but with a path argument (.
) results in no error.