File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
examples/std_misc/process/pipe Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,20 @@ fn main() {
1616 } ;
1717
1818 {
19- // Write a string to the stdin of `wc`.
20- // stdin has type `Option<ChildStdin>`, but since we know this instance
19+ // Write a string to the `stdin` of `wc`.
20+ //
21+ // `stdin` has type `Option<ChildStdin>`, but since we know this instance
2122 // must have one, we can directly `unwrap` it.
2223 match process. stdin . unwrap ( ) . write_all ( PANGRAM . as_bytes ( ) ) {
2324 Err ( why) => panic ! ( "couldn't write to wc stdin: {}" ,
2425 Error :: description( & why) ) ,
2526 Ok ( _) => println ! ( "sent pangram to wc" ) ,
2627 }
2728
28- // `stdin` gets `drop`ed here, and the pipe is closed
29+ // `stdin` gets `drop`ed here, and the pipe is closed.
30+ //
2931 // This is very important, otherwise `wc` wouldn't start processing the
30- // input we just sent
32+ // input we just sent.
3133 }
3234
3335 // The `stdout` field also has type `Option<ChildStdout>` so must be unwrapped.
You can’t perform that action at this time.
0 commit comments