diff --git a/Cargo.lock b/Cargo.lock index 13d188f2f3..0750e56d5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2517,6 +2517,7 @@ dependencies = [ name = "solana-install" version = "0.17.0" dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/install/Cargo.toml b/install/Cargo.toml index 3b0309c50e..571a081120 100644 --- a/install/Cargo.toml +++ b/install/Cargo.toml @@ -13,6 +13,7 @@ cuda = [] [dependencies] +atty = "0.2.11" bincode = "1.1.4" bs58 = "0.2.0" bzip2 = "0.3.3" diff --git a/install/src/main-install-init.rs b/install/src/main-install-init.rs index 53b8b1880c..bf06445730 100644 --- a/install/src/main-install-init.rs +++ b/install/src/main-install-init.rs @@ -1,22 +1,21 @@ +use atty; use std::process::exit; -#[cfg(windows)] fn press_enter() { // On windows, where installation happens in a console that may have opened just for this // purpose, give the user an opportunity to see the error before the window closes. - println!(); - println!("Press the Enter key to continue."); + if cfg!(windows) && atty::is(atty::Stream::Stdin) { + println!(); + println!("Press the Enter key to continue."); - use std::io::BufRead; - let stdin = std::io::stdin(); - let stdin = stdin.lock(); - let mut lines = stdin.lines(); - lines.next(); + use std::io::BufRead; + let stdin = std::io::stdin(); + let stdin = stdin.lock(); + let mut lines = stdin.lines(); + lines.next(); + } } -#[cfg(not(windows))] -fn press_enter() {} - fn main() { solana_install::main_init().unwrap_or_else(|err| { println!("Error: {}", err);