diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-28 07:01:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-28 07:01:12 +0200 |
| commit | a69496002cd08d73fe1c901f2f179ca0a87fefb8 (patch) | |
| tree | 372fa463f12b9a5e8b47914a585ea140078f62f6 | |
| parent | cad4893a527439fe93fbaf5d6ce81d80e2fb9d5f (diff) | |
| parent | b38732f25c326659e860a0fac81775bd07932223 (diff) | |
| download | rust-a69496002cd08d73fe1c901f2f179ca0a87fefb8.tar.gz rust-a69496002cd08d73fe1c901f2f179ca0a87fefb8.zip | |
Rollup merge of #109687 - joshtriplett:document-windows-isterminal-heuristics, r=BurntSushi
Document the heuristics IsTerminal uses on Windows Suggested by `@BurntSushi.`
| -rw-r--r-- | library/std/src/io/stdio.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 0455a00956e..1a3200a5c62 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -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; } |
