1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! The one place this crate writes to stdout.
//!
//! Every emitter above funnels through here, so the `BrokenPipe` policy is
//! stated once. That policy matters: an agent piping into `head` closes the
//! read end early, and treating the resulting error as a failure would turn a
//! normal shell idiom into a non-zero exit.
//!
//! Two error disciplines coexist on purpose. Envelope writers propagate real
//! I/O failures, because a caller that asked for a payload needs to know it
//! never arrived. Stream and passthrough writers swallow them, because partial
//! output is the documented contract there and a half-written stream has no
//! meaningful recovery.
use crateAppError;
use Write;
/// Writes `bytes` followed by a newline, then flushes.
///
/// # Errors
/// Returns [`AppError::Io`] for any I/O failure except `BrokenPipe`, which is
/// reported as success.
pub
/// Writes `bytes` followed by a newline, discarding every error.
///
/// For paths whose contract already accepts partial output.
pub
/// Writes `bytes` verbatim — no newline, no envelope — discarding every error.
pub