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

Replace atty with std::io::IsTerminal #1437

Closed
wants to merge 2 commits into from
Closed
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.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ authors = ["Ashley Williams <[email protected]>", "Jesper Håkansson <je
repository = "https://github.com/rustwasm/wasm-pack.git"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.70.0"
readme = "README.md"
categories = ["wasm"]
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 Expand Up @@ -43,4 +43,3 @@ lazy_static = "1.4.0"
predicates = "3.0.3"
serial_test = "2.0.0"
tempfile = "3.3.0"

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ visiting that repo!

## 🔮 Prerequisites

This project requires Rust 1.30.0 or later.
This project requires Rust 1.70.0 or later.

- [Development Environment](https://rustwasm.github.io/wasm-pack/book/prerequisites/index.html)
- [Installation](https://rustwasm.github.io/wasm-pack/installer)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/prerequisites/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ First you'll want to [install the `wasm-pack` CLI][wasm-pack], and `wasm-pack
[wasm-pack]: https://rustwasm.github.io/wasm-pack/installer/

Next, since `wasm-pack` is a build tool, you'll want to make sure you have
[Rust][rust] installed. Make sure `rustc -V` prints out at least 1.30.0.
[Rust][rust] installed. Make sure `rustc -V` prints out at least 1.70.0.

[rust]: https://www.rust-lang.org/tools/install

Expand Down
2 changes: 1 addition & 1 deletion npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ visiting that repo!

## 🔮 Prerequisites

This project requires Rust 1.30.0 or later.
This project requires Rust 1.70.0 or later.

- [Development Environment](https://rustwasm.github.io/wasm-pack/book/prerequisites/index.html)
- [Installation](https://rustwasm.github.io/wasm-pack/installer)
Expand Down
8 changes: 4 additions & 4 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ pub struct WasmPackVersion {
pub latest: String,
}

/// Ensure that `rustc` is present and that it is >= 1.30.0
/// Ensure that `rustc` is present and that it is >= 1.70.0
pub fn check_rustc_version() -> Result<String> {
let local_minor_version = rustc_minor_version();
match local_minor_version {
Some(mv) => {
if mv < 30 {
if mv < 70 {
bail!(
"Your version of Rust, '1.{}', is not supported. Please install Rust version 1.30.0 or higher.",
"Your version of Rust, '1.{}', is not supported. Please install Rust version 1.70.0 or higher.",
mv.to_string()
)
} else {
Ok(mv.to_string())
}
}
None => bail!("We can't figure out what your Rust version is- which means you might not have Rust installed. Please install Rust version 1.30.0 or higher."),
None => bail!("We can't figure out what your Rust version is- which means you might not have Rust installed. Please install Rust version 1.70.0 or higher."),
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
use std::env;
use std::fs;
use std::io;
use std::path::Path;
use std::process;
use std::{io::IsTerminal, path::Path};

use anyhow::{anyhow, bail, Context, Result};
use atty;
use which;

pub fn install() -> ! {
Expand Down Expand Up @@ -93,7 +92,7 @@ fn confirm_can_overwrite(dst: &Path) -> Result<()> {

// 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 !io::stdin().is_terminal() {
bail!(
"existing wasm-pack installation found at `{}`, pass `-f` to \
force installation over this file, otherwise aborting \
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