guest: init: default to xterm if TERM is not set (#52)

Most terminal emulators support the xterm control codes more faithfully than the
vt100 ones.

Fixes #51.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
This commit is contained in:
Ariadne Conill 2024-04-12 01:52:18 -07:00 committed by GitHub
parent f41a1e2168
commit 73fd95dbe2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -420,7 +420,12 @@ impl GuestInit {
}
env.extend(launch.env.clone());
env.insert("KRATA_CONTAINER".to_string(), "1".to_string());
env.insert("TERM".to_string(), "vt100".to_string());
// If we were not provided a terminal definition in our launch manifest, we
// default to xterm as most terminal emulators support the xterm control codes.
if !env.contains_key("TERM") {
env.insert("TERM".to_string(), "xterm".to_string());
}
let path = GuestInit::resolve_executable(&env, path.into())?;
let Some(file_name) = path.file_name() else {