aboutsummaryrefslogtreecommitdiffstats
path: root/src/pinentry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pinentry.rs')
-rw-r--r--src/pinentry.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs
index d62d4b2..b4d2bb0 100644
--- a/src/pinentry.rs
+++ b/src/pinentry.rs
@@ -8,15 +8,19 @@ pub async fn getpin(
desc: &str,
err: Option<&str>,
tty: Option<&str>,
+ grab: bool,
) -> Result<crate::locked::Password> {
let mut opts = tokio::process::Command::new(pinentry);
opts.stdin(std::process::Stdio::piped())
.stdout(std::process::Stdio::piped());
+ let mut args = vec!["-o", "0"];
if let Some(tty) = tty {
- opts.args(&["-T", tty, "-o", "0"]);
- } else {
- opts.args(&["-o", "0"]);
+ args.extend(&["-T", tty]);
}
+ if !grab {
+ args.push("-g");
+ }
+ opts.args(args);
let mut child = opts.spawn().map_err(|source| Error::Spawn { source })?;
// unwrap is safe because we specified stdin as piped in the command opts
// above