blackhole 0.20.2

...to throw your threads into.
Documentation
/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

Black Hole

Copyright (C) 2019-2020, 2022-2023  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2019-2020".

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
*/

//! # I/O

use std::io::{self, Write};

/// # Locks stderr and writes to it
///
/// - For simplicity, any error will be caught and printed out via `eprintln!()`.
/// - The function will flush stderr when done.
pub (crate) fn lock_write_err<B>(bytes: B) where B: AsRef<[u8]> {
    let stderr = io::stderr();
    let mut stderr = stderr.lock();
    if let Err(err) = (|| {
        stderr.write_all(bytes.as_ref())?;
        stderr.flush()
    })() {
        eprintln!("{}", __!("{}", err));
    }
}