Merge pull request #1436 from mariusvniekerk/remove-atty

chore: Remove unmaintained dependency atty in favor of stdlib
master
Jesper Håkansson 10 months ago committed by GitHub
commit 9a7d8f2a07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 21
      Cargo.lock
  2. 1
      Cargo.toml
  3. 10
      src/installer.rs
  4. 1
      src/main.rs

21
Cargo.lock generated

@ -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"
@ -1815,7 +1795,6 @@ version = "0.13.0"
dependencies = [
"anyhow",
"assert_cmd",
"atty",
"binary-install",
"cargo_metadata",
"chrono",

@ -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"

@ -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,9 +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()
.read_line(&mut line)
.context("failed to read stdin")?;
stdin.read_line(&mut line).context("failed to read stdin")?;
if line.starts_with('y') || line.starts_with('Y') {
return Ok(());

@ -1,7 +1,6 @@
#![allow(clippy::redundant_closure, clippy::redundant_pattern_matching)]
extern crate anyhow;
extern crate atty;
extern crate clap;
extern crate env_logger;
extern crate human_panic;

Loading…
Cancel
Save