diff options
author | Dietrich Daroch <Dietrich.Daroch@gmail.com> | 2021-02-17 17:53:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-17 18:53:42 +0100 |
commit | 96b36322e55cf92cf0ce09d319c72aad946cd550 (patch) | |
tree | ea41a42bb62cb2a2c1849794ae54ef1db0e39842 | |
parent | 3bc3173de8be4c801bc1b56ced5e731bdbeeb0a1 (diff) |
fix: Add a fallback prompt under TERM=dumb (#1594)
TESTED=Run it under `env`, `env 'TERM=dumb` and `env 'TERM=dumber`.
-rw-r--r-- | src/print.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/print.rs b/src/print.rs index 3f3ea34a8..78e67694c 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 { |