#[non_exhaustive]pub enum LineTerminator {
Newline,
CarriageReturn,
}Expand description
How the output pump decides where one captured/streamed line ends.
Set per stream on Command via
line_terminator (both streams at once)
or stdout_line_terminator /
stderr_line_terminator. The
default is Newline — the crate’s pre-1.0
behavior, splitting only on \n.
This is one shared definition of “a line” for the whole line-pumped path:
what stdout_lines /
output_events yield, what the
per-line handlers (on_stdout_line) see,
what a stdout_tee writes (each line followed
by a \n), and what output_string joins.
Choosing a mode moves all of them together — there is never a per-sink
disagreement about what a line is.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Newline
Split on \n only (the default, and the crate’s pre-1.0 behavior).
A \r immediately before a \n is a CRLF terminator and is stripped;
every other \r — a lone one, or a run of them — is line content.
Carriage-return progress output (a bar redrawn in place with \r, no
\n until the very end) therefore accumulates as one ever-growing line:
nothing is delivered until the final \n, and under a byte cap
(with_max_bytes) that single
over-cap line is dropped whole. Reach for
CarriageReturn when you need such
output live.
CarriageReturn
Treat a bare \r as a line terminator in addition to \n —
“\r-aware” mode, for carriage-return progress output.
Each carriage-return frame is delivered as its own line the instant it is
seen, so Progress: 50%\rProgress: 100%\n streams as the frames
Progress: 50% then Progress: 100% — live, one at a time — instead of
piling up as a single line that surfaces only at EOF. A \r\n pair stays
a single terminator (it does not emit a spurious empty line between
the \r and the \n), so ordinary CRLF text reads identically to
Newline mode; only a \r not followed by a
\n splits a frame.
The framing is the shared one described on the type: the handlers, the
tee, the streaming verbs, and output_string all observe the same
per-frame lines. It composes with the byte cap too — a frame whose
content exceeds max_bytes is skipped as
it arrives (never assembled whole), exactly as an over-cap \n line is,
so a runaway \r-free frame cannot exhaust memory.
Trait Implementations§
Source§impl Clone for LineTerminator
impl Clone for LineTerminator
Source§fn clone(&self) -> LineTerminator
fn clone(&self) -> LineTerminator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more