Ask for the password even if stdin is not connected to the TTY.

- As we prompt on the TTY, we can do that even if stdin is not
    connected to it.

  - Reverts f3cfb1b602.

  - Fixes #167.
This commit is contained in:
Justus Winter 2024-01-08 10:40:42 +01:00
parent 1b4761a045
commit fc3e4e046e
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386

View File

@ -7,7 +7,6 @@
#![doc = include_str!(concat!(env!("OUT_DIR"), "/sq-usage.md"))]
use anyhow::Context as _;
use is_terminal::IsTerminal;
use std::borrow::Borrow;
use std::cell::OnceCell;
@ -271,7 +270,6 @@ fn decrypt_key<R>(key: Key<key::SecretParts, R>, passwords: &mut Vec<Password>)
}
}
if std::io::stdin().is_terminal() {
loop {
// Prompt the user.
match common::password::prompt_to_unlock_or_cancel(&format!(
@ -295,7 +293,6 @@ fn decrypt_key<R>(key: Key<key::SecretParts, R>, passwords: &mut Vec<Password>)
}
}
}
}
Err(anyhow::anyhow!("Key {}: Unable to decrypt secret key material",
key.keyid().to_hex()))