MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / isatty

Function isatty

src/backend/linux_raw/termios/syscalls.rs:362–368  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>)

Source from the content-addressed store, hash-verified

360
361#[inline]
362pub(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")]

Callers

nothing calls this directly

Calls 1

tcgetwinsizeFunction · 0.70

Tested by

no test coverage detected