aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2024-01-01 16:12:21 -0500
committerJesse Luehrs <doy@tozt.net>2024-01-01 16:13:02 -0500
commit4e8e04591daf17bd0282b262b2e94869451cd5be (patch)
tree002b96cf2efec49cabcebdb9a2ba09b59070da28
parentb9621938865d4ad24d7bcee7fdbfa0c9c45978c8 (diff)
downloadrbw-4e8e04591daf17bd0282b262b2e94869451cd5be.tar.gz
rbw-4e8e04591daf17bd0282b262b2e94869451cd5be.zip
switch to is-terminal
-rw-r--r--Cargo.lock28
-rw-r--r--Cargo.toml2
-rw-r--r--src/edit.rs4
3 files changed, 8 insertions, 26 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 18f96b0..2dad6e1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -133,17 +133,6 @@ dependencies = [
]
[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi 0.1.19",
- "libc",
- "winapi",
-]
-
-[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -694,15 +683,6 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "hermit-abi"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
@@ -848,7 +828,7 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
- "hermit-abi 0.3.2",
+ "hermit-abi",
"libc",
"windows-sys 0.48.0",
]
@@ -865,7 +845,7 @@ version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
- "hermit-abi 0.3.2",
+ "hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys 0.48.0",
@@ -1095,7 +1075,7 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
- "hermit-abi 0.3.2",
+ "hermit-abi",
"libc",
]
@@ -1316,7 +1296,6 @@ dependencies = [
"argon2",
"arrayvec",
"async-trait",
- "atty",
"base32",
"base64",
"block-padding",
@@ -1333,6 +1312,7 @@ dependencies = [
"hkdf",
"hmac",
"humantime",
+ "is-terminal",
"libc",
"log",
"nix",
diff --git a/Cargo.toml b/Cargo.toml
index a57be0d..b57a208 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,6 @@ anyhow = "1.0.72"
argon2 = "0.5.1"
arrayvec = "0.7.4"
async-trait = "0.1.71"
-atty="0.2.*"
base32 = "0.4.0"
base64 = "0.21.2"
block-padding = "0.3.3"
@@ -65,6 +64,7 @@ zeroize = "1.6.0"
copypasta = "0.8.2"
rmpv = "1.0.0"
tokio-tungstenite = { version = "0.19.0", features = ["rustls-tls-native-roots"] }
+is-terminal = "0.4.7"
[package.metadata.deb]
depends = "pinentry"
diff --git a/src/edit.rs b/src/edit.rs
index 4862c0b..360f31f 100644
--- a/src/edit.rs
+++ b/src/edit.rs
@@ -2,8 +2,10 @@ use crate::prelude::*;
use std::io::{Read as _, Write as _};
+use is_terminal::IsTerminal as _;
+
pub fn edit(contents: &str, help: &str) -> Result<String> {
- if !atty::is(atty::Stream::Stdin) {
+ if !std::io::stdin().is_terminal() {
// directly read from piped content
return match std::io::read_to_string(std::io::stdin()) {
Err(e) => Err(Error::FailedToReadFromStdin { err: e }),