diff --git a/src/bin/cmd/client.rs b/src/bin/cmd/client.rs index b7b7b34c5..60e36ab18 100644 --- a/src/bin/cmd/client.rs +++ b/src/bin/cmd/client.rs @@ -62,6 +62,10 @@ pub fn client_command(client_args: &ArgMatches<'_>, global_config: GlobalConfig) pub fn show_status(config: &ServerConfig, api_secret: Option) { println!(); let title = format!("Grin Server Status"); + if term::stdout().is_none() { + println!("Could not open terminal"); + return; + } let mut t = term::stdout().unwrap(); let mut e = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); diff --git a/wallet/src/display.rs b/wallet/src/display.rs index 041494fba..727d1a287 100644 --- a/wallet/src/display.rs +++ b/wallet/src/display.rs @@ -35,6 +35,10 @@ pub fn outputs( account, cur_height ); println!(); + if term::stdout().is_none() { + println!("Could not open terminal"); + return Ok(()); + } let mut t = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); writeln!(t, "{}", title).unwrap(); @@ -132,6 +136,10 @@ pub fn txs( account, cur_height ); println!(); + if term::stdout().is_none() { + println!("Could not open terminal"); + return Ok(()); + } let mut t = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); writeln!(t, "{}", title).unwrap(); @@ -405,6 +413,10 @@ pub fn accounts(acct_mappings: Vec) { pub fn tx_messages(tx: &TxLogEntry, dark_background_color_scheme: bool) -> Result<(), Error> { let title = format!("Transaction Messages - Transaction '{}'", tx.id,); println!(); + if term::stdout().is_none() { + println!("Could not open terminal"); + return Ok(()); + } let mut t = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); writeln!(t, "{}", title).unwrap();