fq hangs when reading from STDIN
Author: pkoppsteinCreated Jan 16, 2023Updated Aug 6, 2024
What version are you using (fq -v)?
Both:
0.0.10 (darwin amd64)
and:
0.2.0 (darwin amd64)
How was fq installed?
brew install wader/tap/fq
Can you reproduce the problem using the latest release or master branch?
Yes (see above).
What did you do?
#!/bin/bash
# works with jq, gojq but not fq
JQ=fq
< /dev/random tr -cd '0-9' | fold -w 1 | $JQ -Mcnr '
### Generic Utility Functions
# Output: a PRN in range(0;$n) where $n is .
def prn:
if . == 1 then 0
else . as $n
| (($n-1)|tostring|length) as $w
| [limit($w; inputs)] | join("") | tonumber
| if . < $n then . else ($n | prn) end
end;
2 | prn
'What result did you expect?
Same as for jq and gojq
What did you see instead?
The script hangs.
Source: wader/fq