From a7a881809f462688b26ba7b81de85753c3507c22 Mon Sep 17 00:00:00 2001 From: mo8it Date: Mon, 8 Jul 2024 12:53:44 +0200 Subject: [PATCH] Check is_terminal --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a9f7b4a1..3c96d1a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use anyhow::{bail, Context, Result}; use app_state::StateFileStatus; use clap::{Parser, Subcommand}; use std::{ - io::{self, BufRead, StdoutLock, Write}, + io::{self, BufRead, IsTerminal, StdoutLock, Write}, path::Path, process::exit, }; @@ -148,6 +148,10 @@ fn main() -> Result<()> { match args.command { None => { + if !io::stdout().is_terminal() { + bail!("Unsupported or missing terminal/TTY"); + } + let notify_exercise_names = if args.manual_run { None } else {