diff --git a/Cargo.lock b/Cargo.lock index a79f5c7d..cc615eb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,17 +131,6 @@ dependencies = [ "wait-timeout", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.3.0" @@ -766,15 +755,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hex" version = "0.4.3" @@ -1803,7 +1783,6 @@ version = "0.13.0" dependencies = [ "anyhow", "assert_cmd", - "atty", "binary-install", "cargo_metadata", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 8f0078b2..3804d9cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ documentation = "https://rustwasm.github.io/wasm-pack/" [dependencies] anyhow = "1.0.68" -atty = "0.2.14" binary-install = "0.4.1" cargo_metadata = "0.15.2" chrono = "0.4.23" diff --git a/src/installer.rs b/src/installer.rs index 67f2b6b0..2df8b5a7 100644 --- a/src/installer.rs +++ b/src/installer.rs @@ -19,11 +19,11 @@ use std::env; use std::fs; use std::io; +use std::io::IsTerminal; use std::path::Path; use std::process; use anyhow::{anyhow, bail, Context, Result}; -use atty; use which; pub fn install() -> ! { @@ -91,9 +91,11 @@ fn confirm_can_overwrite(dst: &Path) -> Result<()> { return Ok(()); } + let stdin = io::stdin(); + // If we're not attached to a TTY then we can't get user input, so there's // nothing to do except inform the user about the `-f` flag. - if !atty::is(atty::Stream::Stdin) { + if !stdin.is_terminal() { bail!( "existing wasm-pack installation found at `{}`, pass `-f` to \ force installation over this file, otherwise aborting \ @@ -110,7 +112,7 @@ fn confirm_can_overwrite(dst: &Path) -> Result<()> { ); eprint!("info: would you like to overwrite this file? [y/N]: "); let mut line = String::new(); - io::stdin() + stdin .read_line(&mut line) .context("failed to read stdin")?;