Remove unmaintained dependency atty in favor of stdlib

master
Marius van Niekerk 11 months ago
parent 62ab39cf82
commit 650936bbdd
No known key found for this signature in database
GPG Key ID: DF15BF4791F2F815
  1. 21
      Cargo.lock
  2. 1
      Cargo.toml
  3. 8
      src/installer.rs

21
Cargo.lock generated

@ -131,17 +131,6 @@ dependencies = [
"wait-timeout", "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]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.3.0" version = "1.3.0"
@ -766,15 +755,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 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]] [[package]]
name = "hex" name = "hex"
version = "0.4.3" version = "0.4.3"
@ -1803,7 +1783,6 @@ version = "0.13.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
"atty",
"binary-install", "binary-install",
"cargo_metadata", "cargo_metadata",
"chrono", "chrono",

@ -12,7 +12,6 @@ documentation = "https://rustwasm.github.io/wasm-pack/"
[dependencies] [dependencies]
anyhow = "1.0.68" anyhow = "1.0.68"
atty = "0.2.14"
binary-install = "0.4.1" binary-install = "0.4.1"
cargo_metadata = "0.15.2" cargo_metadata = "0.15.2"
chrono = "0.4.23" chrono = "0.4.23"

@ -19,11 +19,11 @@
use std::env; use std::env;
use std::fs; use std::fs;
use std::io; use std::io;
use std::io::IsTerminal;
use std::path::Path; use std::path::Path;
use std::process; use std::process;
use anyhow::{anyhow, bail, Context, Result}; use anyhow::{anyhow, bail, Context, Result};
use atty;
use which; use which;
pub fn install() -> ! { pub fn install() -> ! {
@ -91,9 +91,11 @@ fn confirm_can_overwrite(dst: &Path) -> Result<()> {
return Ok(()); return Ok(());
} }
let stdin = io::stdin();
// If we're not attached to a TTY then we can't get user input, so there's // 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. // nothing to do except inform the user about the `-f` flag.
if !atty::is(atty::Stream::Stdin) { if !stdin.is_terminal() {
bail!( bail!(
"existing wasm-pack installation found at `{}`, pass `-f` to \ "existing wasm-pack installation found at `{}`, pass `-f` to \
force installation over this file, otherwise aborting \ 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]: "); eprint!("info: would you like to overwrite this file? [y/N]: ");
let mut line = String::new(); let mut line = String::new();
io::stdin() stdin
.read_line(&mut line) .read_line(&mut line)
.context("failed to read stdin")?; .context("failed to read stdin")?;

Loading…
Cancel
Save