aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2022-08-20 18:10:34 +0200
committerTeddy Wing2022-08-20 18:10:34 +0200
commit19f554358d19f2cf5f71478aebd1400aff907a79 (patch)
treeebca6c645e8ab7ca6c5e7ddc97d91c7b5fa60154 /src
parentc1f72865741868d094a53fa73ee9b8562202ab0a (diff)
downloadPassextract-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.rs18
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"));
}
}