pub struct Capture(/* private fields */);Expand description
What a run keeps of one output stream of the child.
A constructor chooses the kind of capture. Capture::whole and
Capture::lines return a builder for the settings of their kind, which
RunOptions::stdout and
RunOptions::stderr take as it is. The
default is Capture::discard.
Implementations§
Source§impl Capture
impl Capture
Sourcepub const fn discard() -> Self
pub const fn discard() -> Self
Returns a capture that sends the stream to the null device and keeps nothing.
Sourcepub const fn inherit() -> Self
pub const fn inherit() -> Self
Returns a capture that sends the stream to the tool’s own stream and keeps nothing.
A child in a group of its own is in the background of the terminal.
It can write there unless the terminal has tostop set, and it is
stopped when it reads. A stopped child holds a run with no deadline.
For a step that the person answers, use
Scope::Child with
Input::Inherit, so the child stays in the
tool’s foreground group and the tool carries on when it ends. Ctrl-C
then reaches both.
Sourcepub const fn tail(limit: usize) -> Self
pub const fn tail(limit: usize) -> Self
Returns a capture that reads the whole stream and keeps its last
limit bytes.
Sourcepub const fn whole(limit: usize) -> WholeCapture
pub const fn whole(limit: usize) -> WholeCapture
Returns a capture that keeps the stream’s first limit bytes.
A stream longer than limit bytes is over its limit, and the run
stops the child then unless WholeCapture::over says otherwise.
Sourcepub const fn lines(queue: LineQueue, total: usize) -> LineCapture
pub const fn lines(queue: LineQueue, total: usize) -> LineCapture
Returns a capture that splits the stream into lines and pushes each
line, without its end, to queue while the child runs. A last line
with no end is pushed when the stream ends. The run keeps no bytes in
its Captured.
The first time the stream passes total bytes, line ends and
skipped lines included, the stream is over its limit. No line is
pushed after that, and the run stops the child unless
LineCapture::over says otherwise. Without
LineCapture::line, one line has no limit of its own, and lines
end at b'\n' unless LineCapture::end names another byte.
queue comes from line_queue and serves one
run, which ends it when it returns.