forked from lix-project/lix-installer
fix: provide a convenient message if TERM isn't set
This commit is contained in:
parent
9038c2e7b8
commit
83960c7814
|
@ -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<InstallPlan> = match Path::new(RECEIPT_LOCATION).exists() {
|
||||
|
|
Loading…
Reference in a new issue