Skip to content

Commit a694960

Browse files
authored
Rollup merge of #109687 - joshtriplett:document-windows-isterminal-heuristics, r=BurntSushi
Document the heuristics IsTerminal uses on Windows Suggested by `@BurntSushi.`
2 parents cad4893 + b38732f commit a694960

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: library/std/src/io/stdio.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,15 @@ pub trait IsTerminal: crate::sealed::Sealed {
10541054
/// On platforms where Rust does not know how to detect a terminal yet, this will return
10551055
/// `false`. This will also return `false` if an unexpected error occurred, such as from
10561056
/// passing an invalid file descriptor.
1057+
///
1058+
/// # Platform-specific behavior
1059+
///
1060+
/// On Windows, in addition to detecting consoles, this currently uses some heuristics to
1061+
/// detect older msys/cygwin/mingw pseudo-terminals based on device name: devices with names
1062+
/// starting with `msys-` or `cygwin-` and ending in `-pty` will be considered terminals.
1063+
/// Note that this [may change in the future][changes].
1064+
///
1065+
/// [changes]: io#platform-specific-behavior
10571066
fn is_terminal(&self) -> bool;
10581067
}
10591068

0 commit comments

Comments
 (0)