"The general strategy for implementing `isatty` is...
# random
h
"The general strategy for implementing
isatty
is to attempt a tty-specific
ioctl
operation on the file descriptor, and check for
ENOTTY
error result. Traditionally,
TCGETS
, which is the backend for the
tcgetattr
function, is used, but this is slightly dangerous since the
ioctl
number for it on Linux clashes with legacy OSS sound devices, and if the file descriptor actually refers to a certain type of MIDI device, it will make changes to the device"