From 7b7c7cba21d10eb0b279c1a38c75b44a72dedc4f Mon Sep 17 00:00:00 2001 From: Robert Kelly Date: Wed, 13 Jun 2018 18:07:36 -0400 Subject: [PATCH] changed atty library --- Cargo.toml | 2 +- src/bin/client-demo.rs | 6 +++--- src/bin/fullnode.rs | 6 +++--- src/bin/genesis-demo.rs | 6 +++--- src/bin/genesis.rs | 6 +++--- src/bin/mint-demo.rs | 8 ++++++++ src/bin/mint.rs | 6 +++--- 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 78d0b0889..94b65d0a1 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 0ecd773b1..65f02111c 100644 --- a/src/bin/client-demo.rs +++ b/src/bin/client-demo.rs @@ -1,13 +1,13 @@ extern crate env_logger; extern crate getopts; -extern crate isatty; +extern crate atty; extern crate pnet; extern crate rayon; extern crate serde_json; extern crate solana; use getopts::Options; -use isatty::stdin_isatty; +use atty::{is, Stream}; 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 8741b6a4f..f8eb1c087 100644 --- a/src/bin/fullnode.rs +++ b/src/bin/fullnode.rs @@ -1,13 +1,13 @@ extern crate env_logger; extern crate getopts; -extern crate isatty; +extern crate atty; extern crate serde_json; extern crate solana; #[macro_use] extern crate log; use getopts::Options; -use isatty::stdin_isatty; +use atty::{is, Stream}; 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 acf2a579a..ba5e1dd9e 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 07d7dc89f..24dbce9f1 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 0054c21f6..376fdd509 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 73a67fb12..e62ce1c73 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); }