Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove unmaintained dependency atty in favor of stdlib #1436

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
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
10 changes: 5 additions & 5 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,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(());
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading