3 ms·
You Can Detect If Code Is Being Run Inside a Terminal
- MisterTea 4mo agoShame the post does not go deeper and explain that isatty() is a standard C function specified by POSIX[1]. Depending on the implementation, GNU for example, isatty() calls tcgetattr(3) which performs an ioctl syscall. 1. https://codebrowser.dev/glibc/glibc/sysdeps/posix/isatty.c.html https://codebrowser.dev/glibc/glibc/sysdeps/posix/isatty.c.h... 2. https://codebrowser.dev/glibc/glibc/sysdeps/unix/sysv/linux/tcgetattr.c.html https://codebrowser.dev/glibc/glibc/sysdeps/unix/sysv/linux/...