Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -16,7 +16,6 @@ path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
atty = "0.2.14"
biscuit-auth = { version = "6.0.0", features = ["serde-error", "pem"] }
clap = { version = "^3.0", features = ["color", "derive"] }
chrono = "^0.4"
Expand Down
9 changes: 4 additions & 5 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
use anyhow::{bail, Result};
use atty::Stream;
use biscuit_auth::{
builder::{BiscuitBuilder, BlockBuilder, Rule, Term},
Authorizer, AuthorizerBuilder, PrivateKey, PublicKey, ThirdPartyRequest, UnverifiedBiscuit,
Expand All @@ -13,7 +12,7 @@ use chrono::{DateTime, Duration, Utc};
use clap::{PossibleValue, ValueEnum};
use parse_duration as duration_parser;
use std::fs;
use std::io::{self, Read};
use std::io::{self, IsTerminal, Read};
use std::path::PathBuf;
use std::process::Command;
use std::{collections::HashMap, convert::TryInto};
Expand Down Expand Up @@ -123,7 +122,7 @@ pub fn ensure_no_input_conflict_third_party(
}

pub fn read_stdin_string(desc: &str) -> Result<String> {
if atty::is(Stream::Stdin) && atty::is(Stream::Stderr) {
if io::stdin().is_terminal() && io::stderr().is_terminal() {
eprintln!("Please input a {}, followed by <enter> and ^D", &desc);
}
let mut buffer = String::new();
Expand All @@ -132,7 +131,7 @@ pub fn read_stdin_string(desc: &str) -> Result<String> {
}

pub fn read_stdin_bytes() -> Result<Vec<u8>> {
if atty::is(Stream::Stdin) {
if io::stdin().is_terminal() {
Err(BinaryFromTTY)?
}
let mut buffer = Vec::new();
Expand All @@ -146,7 +145,7 @@ pub fn read_editor_string() -> Result<String> {
.tempfile()?;
let path = &file.path();

if atty::isnt(Stream::Stdin) || atty::isnt(Stream::Stdout) {
if !io::stdin().is_terminal() || !io::stdout().is_terminal() {
Err(EditorOutsideTTY)?
}

Expand Down