diff options
| author | Usama Arif <usama.arif@bytedance.com> | 2022-09-04 18:43:18 +0100 |
|---|---|---|
| committer | Usama Arif <usama.arif@bytedance.com> | 2022-09-07 14:22:57 +0100 |
| commit | dfbc1f712d61340dab653ac8d54bdc701b64e2ec (patch) | |
| tree | 2bc5064fbdc4f2ae52af2abfacefcb4a3539555d /library/std/src/io/stdio.rs | |
| parent | e7c7aa7288559f8e5ea7ce3543ff946b09783628 (diff) | |
| download | rust-dfbc1f712d61340dab653ac8d54bdc701b64e2ec.tar.gz rust-dfbc1f712d61340dab653ac8d54bdc701b64e2ec.zip | |
stdio: Document no support for writing to non-blocking stdio/stderr
Printing to stdio/stderr that have been opened with non-blocking (O_NONBLOCK in linux) can result in an error, which is not handled by std::io module causing a panic. Signed-off-by: Usama Arif <usama.arif@bytedance.com>
Diffstat (limited to 'library/std/src/io/stdio.rs')
| -rw-r--r-- | library/std/src/io/stdio.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 91cff3217d2..2dc12a18a8a 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -992,6 +992,9 @@ pub fn set_output_capture(sink: Option<LocalStream>) -> Option<LocalStream> { /// the global stream. /// /// However, if the actual I/O causes an error, this function does panic. +/// +/// Writing to non-blocking stdout/stderr can cause an error, which will lead +/// this function to panic. fn print_to<T>(args: fmt::Arguments<'_>, global_s: fn() -> T, label: &str) where T: Write, |
