Disable Enter prompt when stdin is not a tty (#4874) (#4877)

(cherry picked from commit 41bda18046)
This commit is contained in:
mergify[bot]
2019-06-28 18:18:39 -07:00
committed by Michael Vines
parent e6d6fc4391
commit 462d0cfc6c
3 changed files with 12 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ cuda = []
[dependencies]
atty = "0.2.11"
bincode = "1.1.4"
bs58 = "0.2.0"
bzip2 = "0.3.3"

View File

@@ -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);