Disable Enter prompt when stdin is not a tty (#4874)
This commit is contained in:
parent
0c832f4668
commit
41bda18046
|
@ -2517,6 +2517,7 @@ dependencies = [
|
||||||
name = "solana-install"
|
name = "solana-install"
|
||||||
version = "0.17.0"
|
version = "0.17.0"
|
||||||
dependencies = [
|
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)",
|
"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)",
|
"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)",
|
"bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -13,6 +13,7 @@ cuda = []
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
atty = "0.2.11"
|
||||||
bincode = "1.1.4"
|
bincode = "1.1.4"
|
||||||
bs58 = "0.2.0"
|
bs58 = "0.2.0"
|
||||||
bzip2 = "0.3.3"
|
bzip2 = "0.3.3"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use atty;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
fn press_enter() {
|
fn press_enter() {
|
||||||
// On windows, where installation happens in a console that may have opened just for this
|
// 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.
|
// purpose, give the user an opportunity to see the error before the window closes.
|
||||||
|
if cfg!(windows) && atty::is(atty::Stream::Stdin) {
|
||||||
println!();
|
println!();
|
||||||
println!("Press the Enter key to continue.");
|
println!("Press the Enter key to continue.");
|
||||||
|
|
||||||
|
@ -13,9 +14,7 @@ fn press_enter() {
|
||||||
let mut lines = stdin.lines();
|
let mut lines = stdin.lines();
|
||||||
lines.next();
|
lines.next();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn press_enter() {}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
solana_install::main_init().unwrap_or_else(|err| {
|
solana_install::main_init().unwrap_or_else(|err| {
|
||||||
|
|
Loading…
Reference in New Issue