From 96b36322e55cf92cf0ce09d319c72aad946cd550 Mon Sep 17 00:00:00 2001 From: Dietrich Daroch Date: Wed, 17 Feb 2021 17:53:42 +0000 Subject: [PATCH] fix: Add a fallback prompt under TERM=dumb (#1594) TESTED=Run it under `env`, `env 'TERM=dumb` and `env 'TERM=dumber`. --- src/print.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/print.rs b/src/print.rs index 3f3ea34a..78e67694 100644 --- a/src/print.rs +++ b/src/print.rs @@ -27,6 +27,15 @@ pub fn get_prompt(context: Context) -> String { let config = context.config.get_root_config(); let mut buf = String::new(); + match std::env::var_os("TERM") { + Some(term) if term == "dumb" => { + log::error!("Under a 'dumb' terminal (TERM=dumb)."); + buf.push_str("Starship disabled due to TERM=dumb > "); + return buf; + } + _ => {} + } + // A workaround for a fish bug (see #739,#279). Applying it to all shells // breaks things (see #808,#824,#834). Should only be printed in fish. if let Shell::Fish = context.shell {