Skip to content

Commit

Permalink
Fix: Remove dependency on unmaintained atty (#10)
Browse files Browse the repository at this point in the history
atty is unmaintained for a while. and github dependabot says there
is a detected vulnerability in it.

So let's use new IsTerminal trait from stdlib instead
  • Loading branch information
nain-F49FF806 authored Apr 10, 2024
1 parent 56e165d commit 77231cb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ crypto-mac = "0.11.1"
hmac = "0.11.0"
sha2 = "0.9.8"
url = { version = "2.2.2", features = ["serde"] }
atty = "0.2.14"
rand_chacha = "0.3.1"
dialoguer = "0.9.0"
data-url = "0.1.1"
Expand Down
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use pbcli::opts::Opts;
use pbcli::privatebin::DecryptedPaste;
use pbcli::util::check_filesize;
use serde_json::Value;
use std::io::IsTerminal;
use std::io::{Read, Write};

fn get_stdin() -> std::io::Result<String> {
if atty::is(atty::Stream::Stdin) {
if std::io::stdin().is_terminal() {
return Ok("".into());
}
let mut buffer = String::new();
Expand Down Expand Up @@ -43,7 +44,7 @@ fn handle_get(opts: &Opts) -> PbResult<()> {
match paste.decrypt(key) {
Ok(c) => content = c,
Err(err) => {
if !atty::is(atty::Stream::Stdin) {
if !std::io::stdin().is_terminal() {
return Err(err);
}

Expand Down

0 comments on commit 77231cb

Please sign in to comment.