diff options
author | Teddy Wing | 2022-08-20 18:19:02 +0200 |
---|---|---|
committer | Teddy Wing | 2022-08-20 18:19:02 +0200 |
commit | 37924c5c6030eecf91a04378a00a47cec550da49 (patch) | |
tree | ebca6c645e8ab7ca6c5e7ddc97d91c7b5fa60154 /src | |
parent | c4515f55b8778f8128a853e1632a60b34d666ae8 (diff) | |
parent | 19f554358d19f2cf5f71478aebd1400aff907a79 (diff) | |
download | Passextract-37924c5c6030eecf91a04378a00a47cec550da49.tar.bz2 |
Merge branch 'support-gnupg2'
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 47095b8..ac289cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,15 +63,20 @@ fn parse_options(filename: &str) -> Vec<String> { push_option(&mut options, line.to_owned()); } } else { - let file = Command::new("pass") + let mut child = Command::new("pass") .arg("show") .arg(filename) - .output() - .expect("Error executing `pass`") - .stdout; + .stdout(std::process::Stdio::piped()) + .spawn() + .expect("Error executing `pass`"); - for line in String::from_utf8_lossy(&file).lines() { - push_option(&mut options, line.to_owned()); + child.wait().expect("Error waiting for `pass`"); + + let stdout = child.stdout.expect("No standard output"); + let file = io::BufReader::new(stdout); + + for line in file.lines() { + push_option(&mut options, line.expect("Error reading line")); } } |