Hacker News new | ask | show | jobs
by 5e92cb50239222b 1169 days 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).
2 comments

That's wild given that Go makes it harder to read a whole file than read a block at a time.
Here is where the file is read in its entirety. https://github.com/koki-develop/gat/blob/c16dbf999b89b46ed17...
Oh, absolutely not! ioutil.ReadFile and you're done!
At least we know the problem and the solution to it
Wow, I would expect handling streaming properly to be the default case