(fd: BorrowedFd<'_>)
| 360 | |
| 361 | #[inline] |
| 362 | pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool { |
| 363 | // On error, Linux will return either `EINVAL` (2.6.32) or `ENOTTY` |
| 364 | // (otherwise), because we assume we're never passing an invalid |
| 365 | // file descriptor (which would get `EBADF`). Either way, an error |
| 366 | // means we don't have a tty. |
| 367 | tcgetwinsize(fd).is_ok() |
| 368 | } |
| 369 | |
| 370 | #[cfg(feature = "alloc")] |
| 371 | #[cfg(feature = "fs")] |
nothing calls this directly
no test coverage detected