4 ms·
I just tried both gat and bat to see if they could really replace cat (spoiler: they cannot — unlike cat they soak up all input before outputting anything, and
by 5e92cb50239222b 4y ago
I just tried both gat and bat to see if they could really replace cat (spoiler: they cannot — unlike cat they soak up all input before outputting anything, and crash with out of memory very quickly).
A cat alternative would have to handle this correctly:
$ </dev/zero cat >/dev/null
or it's not really a cat alternative. (Yes, variations on this theme are very useful in scripts and daily shell hacking).
- morelisp 4y agoThat's wild given that Go makes it harder to read a whole file than read a block at a time.
- nasretdinov 4y agoOh, absolutely not! ioutil.ReadFile and you're done!
- Patrickmi 4y agoAt least we know the problem and the solution to it
- skulk 4y agoHere is where the file is read in its entirety. https://github.com/koki-develop/gat/blob/c16dbf999b89b46ed17f5acf94e2250a97b8dcfc/pkg/printer/printer.go#L85-L88 https://github.com/koki-develop/gat/blob/c16dbf999b89b46ed17...
- Fire-Dragon-DoL 4y agoWow, I would expect handling streaming properly to be the default case