Check is_terminal

This commit is contained in:
mo8it 2024-07-08 12:53:44 +02:00
parent 0f4cb94cfe
commit a7a881809f

View file

@ -2,7 +2,7 @@ use anyhow::{bail, Context, Result};
use app_state::StateFileStatus; use app_state::StateFileStatus;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use std::{ use std::{
io::{self, BufRead, StdoutLock, Write}, io::{self, BufRead, IsTerminal, StdoutLock, Write},
path::Path, path::Path,
process::exit, process::exit,
}; };
@ -148,6 +148,10 @@ fn main() -> Result<()> {
match args.command { match args.command {
None => { None => {
if !io::stdout().is_terminal() {
bail!("Unsupported or missing terminal/TTY");
}
let notify_exercise_names = if args.manual_run { let notify_exercise_names = if args.manual_run {
None None
} else { } else {