diff options
author | Teddy Wing | 2022-08-20 18:10:34 +0200 |
---|---|---|
committer | Teddy Wing | 2022-08-20 18:10:34 +0200 |
commit | 19f554358d19f2cf5f71478aebd1400aff907a79 (patch) | |
tree | ebca6c645e8ab7ca6c5e7ddc97d91c7b5fa60154 /src | |
parent | c1f72865741868d094a53fa73ee9b8562202ab0a (diff) | |
download | Passextract-19f554358d19f2cf5f71478aebd1400aff907a79.tar.bz2 |
parse_options: Clean up `Command.spawn` code
* Remove old in-progress code
* Remove `child.stdout.take()` call, which is suggested in
https://doc.rust-lang.org/std/process/struct.Child.html#structfield.stdout
but ended up not being necessary in this instance.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs index 7701dd3..ac289cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,25 +72,11 @@ fn parse_options(filename: &str) -> Vec<String> { child.wait().expect("Error waiting for `pass`"); - let stdout = child.stdout.take().unwrap(); - - // let file = stdout; - // let stdout = child.stdout.unwrap(); + let stdout = child.stdout.expect("No standard output"); let file = io::BufReader::new(stdout); - // let mut line = String::new(); - - // loop { - // let n_bytes = file.read_line(&mut line).unwrap(); - // if n_bytes == 0 { - // break; - // } - // - // push_option(&mut options, line.to_owned()); - // } - for line in file.lines() { - push_option(&mut options, line.unwrap()); + push_option(&mut options, line.expect("Error reading line")); } } |