Skip to content

Commit

Permalink
Remove unmaintained dependency atty in favor of stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusvniekerk committed Sep 30, 2024
1 parent 62ab39c commit 650936b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
21 changes: 0 additions & 21 deletions 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 @@ -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"
Expand Down
8 changes: 5 additions & 3 deletions src/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() -> ! {
Expand Down Expand Up @@ -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 \
Expand All @@ -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")?;

Expand Down

0 comments on commit 650936b

Please sign in to comment.