diff --git a/Cargo.toml b/Cargo.toml index 78d0b08890d7a9..94b65d0a10eb18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,6 @@ matches = "0.1.6" byteorder = "1.2.1" libc = "0.2.1" getopts = "0.2" -isatty = "0.1" +atty = "0.2" rand = "0.5.1" pnet = "0.21.0" diff --git a/src/bin/client-demo.rs b/src/bin/client-demo.rs index 0ecd773b1a0e03..78974af89963f5 100644 --- a/src/bin/client-demo.rs +++ b/src/bin/client-demo.rs @@ -1,13 +1,13 @@ +extern crate atty; extern crate env_logger; extern crate getopts; -extern crate isatty; extern crate pnet; extern crate rayon; extern crate serde_json; extern crate solana; +use atty::{is, Stream}; use getopts::Options; -use isatty::stdin_isatty; use pnet::datalink; use rayon::prelude::*; use solana::crdt::{Crdt, ReplicatedData}; @@ -114,7 +114,7 @@ fn main() { ); assert_eq!(validators.len(), num_nodes); - if stdin_isatty() { + if is(Stream::Stdin) { eprintln!("nothing found on stdin, expected a json file"); exit(1); } diff --git a/src/bin/fullnode.rs b/src/bin/fullnode.rs index 8741b6a4f80b07..a4648a857320c1 100644 --- a/src/bin/fullnode.rs +++ b/src/bin/fullnode.rs @@ -1,13 +1,13 @@ +extern crate atty; extern crate env_logger; extern crate getopts; -extern crate isatty; extern crate serde_json; extern crate solana; #[macro_use] extern crate log; +use atty::{is, Stream}; use getopts::Options; -use isatty::stdin_isatty; use solana::bank::Bank; use solana::crdt::ReplicatedData; use solana::entry::Entry; @@ -56,7 +56,7 @@ fn main() { print_usage(&program, opts); return; } - if stdin_isatty() { + if is(Stream::Stdin) { eprintln!("nothing found on stdin, expected a log file"); exit(1); } diff --git a/src/bin/genesis-demo.rs b/src/bin/genesis-demo.rs index acf2a579a8aa26..ba5e1dd9e651af 100644 --- a/src/bin/genesis-demo.rs +++ b/src/bin/genesis-demo.rs @@ -1,9 +1,9 @@ -extern crate isatty; +extern crate atty; extern crate rayon; extern crate serde_json; extern crate solana; -use isatty::stdin_isatty; +use atty::{is, Stream}; use rayon::prelude::*; use solana::bank::MAX_ENTRY_IDS; use solana::entry::{next_entry, Entry}; @@ -15,7 +15,7 @@ use std::process::exit; // Generate a ledger with lots and lots of accounts. fn main() { - if stdin_isatty() { + if is(Stream::Stdin) { eprintln!("nothing found on stdin, expected a json file"); exit(1); } diff --git a/src/bin/genesis.rs b/src/bin/genesis.rs index 07d7dc89fc0f85..24dbce9f132fdd 100644 --- a/src/bin/genesis.rs +++ b/src/bin/genesis.rs @@ -1,16 +1,16 @@ //! A command-line executable for generating the chain's genesis block. -extern crate isatty; +extern crate atty; extern crate serde_json; extern crate solana; -use isatty::stdin_isatty; +use atty::{is, Stream}; use solana::mint::Mint; use std::io::{stdin, Read}; use std::process::exit; fn main() { - if stdin_isatty() { + if is(Stream::Stdin) { eprintln!("nothing found on stdin, expected a json file"); exit(1); } diff --git a/src/bin/mint-demo.rs b/src/bin/mint-demo.rs index 0054c21f664288..376fdd509abcd9 100644 --- a/src/bin/mint-demo.rs +++ b/src/bin/mint-demo.rs @@ -1,13 +1,21 @@ +extern crate atty; extern crate rayon; extern crate ring; extern crate serde_json; extern crate solana; +use atty::{is, Stream}; use solana::mint::{Mint, MintDemo}; use std::io; +use std::process::exit; fn main() { let mut input_text = String::new(); + if is(Stream::Stdin) { + eprintln!("nothing found on stdin, expected a token number"); + exit(1); + } + io::stdin().read_line(&mut input_text).unwrap(); let trimmed = input_text.trim(); let tokens = trimmed.parse::().unwrap(); diff --git a/src/bin/mint.rs b/src/bin/mint.rs index 73a67fb129897a..e62ce1c73b90dc 100644 --- a/src/bin/mint.rs +++ b/src/bin/mint.rs @@ -1,15 +1,15 @@ -extern crate isatty; +extern crate atty; extern crate serde_json; extern crate solana; -use isatty::stdin_isatty; +use atty::{is, Stream}; use solana::mint::Mint; use std::io; use std::process::exit; fn main() { let mut input_text = String::new(); - if stdin_isatty() { + if is(Stream::Stdin) { eprintln!("nothing found on stdin, expected a token number"); exit(1); }