Issues running with ripgrep (rg)

I’ve noticed an issue running cells which shell out to ripgrep (rg). It seems like it could be an issue with that utility specifically, but it only occurs in notebooks (tested with ipython kernel and Jupyter Lab). The symptom is:

I make a call that returns results using something like

!rg '{some_pattern}'

Then I try to modify the cell to capture the output using something like

output = !rg '{some_pattern}'
output

But the output is always empty. It gives a different result if I append the current working directory (.).

output = !rg '{some_pattern}' .
output

But I would like to know why that is required. What changes in the notebook between the first form and the second? Is it messing with stdin or something like that?