From dfbc1f712d61340dab653ac8d54bdc701b64e2ec Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Sun, 4 Sep 2022 18:43:18 +0100 Subject: 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 --- library/std/src/io/stdio.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'library/std/src/io/stdio.rs') 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) -> Option { /// 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(args: fmt::Arguments<'_>, global_s: fn() -> T, label: &str) where T: Write, -- cgit 1.4.1-3-g733a5