Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the heuristics IsTerminal uses on Windows #109687

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions library/std/src/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,15 @@ pub trait IsTerminal: crate::sealed::Sealed {
/// On platforms where Rust does not know how to detect a terminal yet, this will return
/// `false`. This will also return `false` if an unexpected error occurred, such as from
/// passing an invalid file descriptor.
///
/// # Platform-specific behavior
///
/// On Windows, in addition to detecting consoles, this currently uses some heuristics to
/// detect older msys/cygwin/mingw pseudo-terminals based on device name: devices with names
/// starting with `msys-` or `cygwin-` and ending in `-pty` will be considered terminals.
/// Note that this [may change in the future][changes].
///
/// [changes]: io#platform-specific-behavior
fn is_terminal(&self) -> bool;
}

Expand Down