aboutsummaryrefslogtreecommitdiffstats
path: root/src/pinentry.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-12 00:08:03 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-12 00:08:03 -0400
commit236f06736e45c2a70f43589c9d447a0a3ef240b5 (patch)
treec390d4cbfec5223ac1aefe3947f8e1bb885757d2 /src/pinentry.rs
parent91d1d1890bdc3ee75b69e00d5368c5b29a4f461c (diff)
downloadrbw-236f06736e45c2a70f43589c9d447a0a3ef240b5.tar.gz
rbw-236f06736e45c2a70f43589c9d447a0a3ef240b5.zip
improve error handling and reporting
Diffstat (limited to 'src/pinentry.rs')
-rw-r--r--src/pinentry.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs
index 4a2196e..769b8d0 100644
--- a/src/pinentry.rs
+++ b/src/pinentry.rs
@@ -17,6 +17,8 @@ pub async fn getpin(
opts
};
let mut child = opts.spawn().context(crate::error::Spawn)?;
+ // unwrap is safe because we specified stdin as piped in the command opts
+ // above
let mut stdin = child.stdin.take().unwrap();
stdin
@@ -39,6 +41,8 @@ pub async fn getpin(
let mut buf = crate::locked::Vec::new();
buf.extend(std::iter::repeat(0));
+ // unwrap is safe because we specified stdout as piped in the command opts
+ // above
let len =
read_password(buf.data_mut(), child.stdout.as_mut().unwrap()).await?;
buf.truncate(len);