forked from qt-creator/qt-creator
ProcessStub: Preserve the TERM environment variable
* If Creator is not executed from terminal, this value is missing. * If it is executed from a terminal of another type than the stub it might be wrong. Change-Id: Ia6bd1dd59be04e01398ed5cdffff3080539b10ef Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
ff1b87f0d1
commit
9ab72ac045
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user