Skip to content

Commit 13c8e51

Browse files
committed
[deps] replace atty with is_terminal
1 parent 991d603 commit 13c8e51

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

Cargo.lock

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ description = "Alternative CLI for KeePass with Emacs integration"
1111

1212
[dependencies]
1313
anyhow = "1.0.66"
14-
atty = "0.2.14"
1514
clap = { version = "4.0.26", features = ["derive"] }
1615
clap-verbosity-flag = "2.0.0"
16+
is-terminal = "0.4.0"
1717
keepass = { path = "../keepass-rs" }
1818
lexpr = "0.2.6"
1919
libreauth = "0.15.0"

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use anyhow::{anyhow, bail, Result};
44
use clap::Parser;
55
use clap_verbosity_flag::Verbosity;
6+
use is_terminal::IsTerminal;
67
use keepass::{Database, Entry, NodeRef};
78
use libreauth::oath::TOTPBuilder;
89
use rustyline::error::ReadlineError;
@@ -434,7 +435,7 @@ fn main() -> Result<()> {
434435
// Open KeePass database
435436
let binding = args.database.unwrap();
436437
let path = std::path::Path::new(&binding);
437-
let password = if atty::is(atty::Stream::Stdout) && atty::is(atty::Stream::Stdin) {
438+
let password = if std::io::stdin().is_terminal() && std::io::stdout().is_terminal() {
438439
rpassword::prompt_password("Password (or blank for none): ").expect("Read password")
439440
} else {
440441
let mut t = String::new();

0 commit comments

Comments
 (0)