From 8b682ac7f55d3762875631df21ec28ff9d0a7669 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 30 Apr 2024 08:33:48 +0200 Subject: [PATCH] Terminal: Fix TERM env variable Some (Fedora) OS/Distros set a default value for TERM such as "dumb", which then breaks command line tools such as "clear" which try to figure out what terminal they are running in. Therefore we have to force-set our own TERM value. Fixes: QTCREATORBUG-30737 Change-Id: I50ac86f17c92dc7bc477cc59ed43ec22025593fb Reviewed-by: Christian Stenger --- src/plugins/terminal/terminalwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp index 756f1a11bee..c7bdab9b2a8 100644 --- a/src/plugins/terminal/terminalwidget.cpp +++ b/src/plugins/terminal/terminalwidget.cpp @@ -119,8 +119,12 @@ void TerminalWidget::setupPty() Environment env = m_openParameters.environment.value_or(Environment{}) .appliedToEnvironment(shellCommand.executable().deviceEnvironment()); + // Some OS/Distros set a default value for TERM such as "dumb", which then breaks + // command line tools such as "clear" which try to figure out what terminal they are + // running in. Therefore we have to force-set our own TERM value here. + env.set("TERM", "xterm-256color"); + // Set some useful defaults - env.setFallback("TERM", "xterm-256color"); env.setFallback("TERM_PROGRAM", QCoreApplication::applicationName()); env.setFallback("COLORTERM", "truecolor"); env.setFallback("COMMAND_MODE", "unix2003");