mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-21 19:13:07 +00:00
Improve description of continous output processing (#380)
This commit is contained in:
parent
20cef5b8d4
commit
c1f50576e5
1 changed files with 5 additions and 6 deletions
|
@ -558,13 +558,12 @@ fn run() -> Result<()> {
|
|||
|
||||
[![std-badge]][std] [![cat-os-badge]][cat-os]
|
||||
|
||||
Contrary to [Run an external command and process
|
||||
stdout](#ex-parse-subprocess-output), while an external [`Command`] is
|
||||
running, process its standard output without waiting it to finish. A
|
||||
new pipe is created by [`Stdio::piped`] and it is read continuously by
|
||||
a [`BufReader`].
|
||||
In [Run an external command and process stdout](#ex-parse-subprocess-output),
|
||||
processing doesn't start until external [`Command`] is finished.
|
||||
The recipe below creates a new pipe by calling [`Stdio::piped`] and reads
|
||||
`stdout` continuously as soon as the [`BufReader`] is updated.
|
||||
|
||||
The below recipe is equivalent to run the Unix shell command
|
||||
The below recipe is equivalent to the Unix shell command
|
||||
`journalctl | grep usb`.
|
||||
|
||||
```rust,no_run
|
||||
|
|
Loading…
Reference in a new issue