an aside, but it’s super weird that programs can detect if output is being redirected.
“It’s all text” really ends up generating a bunch of weird hacks doesn’t it
“It’s all stdout” really. The hacks are there precisely because it’s not all text :)
I was curious about that too. Edit: Ahh, found it: isatty Usage
Looking for zeroes… I take note of the trick!
This is the same trick that GNU grep uses as well, although I don’t know its origins. IIRC, GNU grep checks for a zero byte anywhere in the file.
Openbsd grew does the same. There were some experiments with more elaborate checks, but they tended to fail in weird ways. A zero byte check turns out to be pretty reliable.
Thank goodness. This updated behaviour is a lot more sensible.
Commit
an aside, but it’s super weird that programs can detect if output is being redirected.
“It’s all text” really ends up generating a bunch of weird hacks doesn’t it
“It’s all stdout” really. The hacks are there precisely because it’s not all text :)
I was curious about that too.
Edit: Ahh, found it:
isatty
Usage
Looking for zeroes… I take note of the trick!
This is the same trick that GNU grep uses as well, although I don’t know its origins. IIRC, GNU grep checks for a zero byte anywhere in the file.
Openbsd grew does the same. There were some experiments with more elaborate checks, but they tended to fail in weird ways. A zero byte check turns out to be pretty reliable.
Thank goodness. This updated behaviour is a lot more sensible.
Commit