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>
This commit is contained in:
parent
e7c7aa7288
commit
dfbc1f712d
2 changed files with 15 additions and 0 deletions
|
@ -992,6 +992,9 @@ pub fn set_output_capture(sink: Option<LocalStream>) -> Option<LocalStream> {
|
||||||
/// the global stream.
|
/// the global stream.
|
||||||
///
|
///
|
||||||
/// However, if the actual I/O causes an error, this function does panic.
|
/// 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)
|
fn print_to<T>(args: fmt::Arguments<'_>, global_s: fn() -> T, label: &str)
|
||||||
where
|
where
|
||||||
T: Write,
|
T: Write,
|
||||||
|
|
|
@ -49,6 +49,9 @@ macro_rules! panic {
|
||||||
///
|
///
|
||||||
/// Panics if writing to `io::stdout()` fails.
|
/// Panics if writing to `io::stdout()` fails.
|
||||||
///
|
///
|
||||||
|
/// Writing to non-blocking stdout can cause an error, which will lead
|
||||||
|
/// this macro to panic.
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -107,6 +110,9 @@ macro_rules! print {
|
||||||
///
|
///
|
||||||
/// Panics if writing to [`io::stdout`] fails.
|
/// Panics if writing to [`io::stdout`] fails.
|
||||||
///
|
///
|
||||||
|
/// Writing to non-blocking stdout can cause an error, which will lead
|
||||||
|
/// this macro to panic.
|
||||||
|
///
|
||||||
/// [`io::stdout`]: crate::io::stdout
|
/// [`io::stdout`]: crate::io::stdout
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
@ -147,6 +153,9 @@ macro_rules! println {
|
||||||
///
|
///
|
||||||
/// Panics if writing to `io::stderr` fails.
|
/// Panics if writing to `io::stderr` fails.
|
||||||
///
|
///
|
||||||
|
/// Writing to non-blocking stdout can cause an error, which will lead
|
||||||
|
/// this macro to panic.
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -179,6 +188,9 @@ macro_rules! eprint {
|
||||||
///
|
///
|
||||||
/// Panics if writing to `io::stderr` fails.
|
/// Panics if writing to `io::stderr` fails.
|
||||||
///
|
///
|
||||||
|
/// Writing to non-blocking stdout can cause an error, which will lead
|
||||||
|
/// this macro to panic.
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue