diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 05396dac036..1374d06f16b 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -124,6 +124,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args) return false; } + d->m_environment.unset(QLatin1String("TERM")); QStringList env = d->m_environment.toStringList(); if (!env.isEmpty()) { d->m_tempFile = new QTemporaryFile(); diff --git a/src/libs/utils/process_stub_unix.c b/src/libs/utils/process_stub_unix.c index b061f7f8173..4a9df676b5c 100644 --- a/src/libs/utils/process_stub_unix.c +++ b/src/libs/utils/process_stub_unix.c @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) if (*argv[ArgEnv]) { FILE *envFd; - char *envdata, *edp; + char *envdata, *edp, *termEnv; long size; int count; if (!(envFd = fopen(argv[ArgEnv], "r"))) { @@ -225,11 +225,13 @@ int main(int argc, char *argv[]) fclose(envFd); for (count = 0, edp = envdata; edp < envdata + size; ++count) edp += strlen(edp) + 1; - env = malloc((count + 1) * sizeof(char *)); + env = malloc((count + 2) * sizeof(char *)); for (count = 0, edp = envdata; edp < envdata + size; ++count) { env[count] = edp; edp += strlen(edp) + 1; } + if ((termEnv = getenv("TERM"))) + env[count++] = termEnv - 5; env[count] = 0; }