Skip to main content

write_stderr_line_to

Function write_stderr_line_to 

Source
pub fn write_stderr_line_to(err: &mut impl Write, content: &str) -> Result<()>
Expand description

Writes a diagnostic line to an arbitrary Write (G-IO-11 DI primitive).

Unlike write_line_to, BrokenPipe is treated as success (downstream closed) so human/error paths never panic the process on a closed pipe.

§Examples

use ssh_cli::output::write_stderr_line_to;
use std::io::Cursor;

let mut buf = Cursor::new(Vec::new());
write_stderr_line_to(&mut buf, "warn").unwrap();
assert_eq!(String::from_utf8(buf.into_inner()).unwrap(), "warn\n");

§Errors

Non-pipe I/O failures from the underlying writer.