diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 73cdfe2..aec2d81 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -1,4 +1,5 @@ use std::{ + io::{stdout, Write}, os::unix::prelude::PermissionsExt, path::{Path, PathBuf}, process::ExitCode, @@ -80,6 +81,22 @@ impl CommandExecute for Install { explain, } = self; + // Get our terminal object, explaining what to do if it's not there. + let term = + term::terminfo::TerminfoTerminal::new(stdout()); + if term.is_none() && !no_confirm { + eprintln!( + "{}", + format!("\ + \n\ + Couldn't figure out which terminal you're using -- check the value of the $TERM variable.\n\n\ + If you're using an interactive terminal, it's probably safe to set TERM to \"xterm\",\n\ + by e.g. running 'export TERM=xterm'.\n\ + ").red() + ); + interaction::clean_exit_with_message("Couldn't get the terminal! Aborting.").await; + } + ensure_root()?; let existing_receipt: Option = match Path::new(RECEIPT_LOCATION).exists() {