forked from qt-creator/qt-creator
Utils: Continue Environment/EnvironmentChange consolidation
Make Environment a stack of changes that gets "expanded" to a full environment before things are actively accessed. Later this expansion should be done lazily if possible. Task-number: QTCREATORBUG-28357 Change-Id: If1c7bfdb9f58b81e71c51ed87ee75d6964a47019 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -338,9 +338,6 @@ Environment LinuxDevicePrivate::getEnvironment()
|
||||
|
||||
QtcProcess getEnvProc;
|
||||
getEnvProc.setCommand({FilePath("env").onDevice(q->rootPath()), {}});
|
||||
Environment inEnv;
|
||||
inEnv.setCombineWithDeviceEnvironment(false);
|
||||
getEnvProc.setEnvironment(inEnv);
|
||||
getEnvProc.runBlocking();
|
||||
|
||||
const QString remoteOutput = getEnvProc.cleanedStdOut();
|
||||
@@ -919,16 +916,11 @@ LinuxDevice::LinuxDevice()
|
||||
d->m_terminals.removeOne(proc);
|
||||
});
|
||||
|
||||
// We recreate the same way that QtcProcess uses to create the actual environment.
|
||||
const Environment finalEnv = (!env.hasChanges() && env.combineWithDeviceEnvironment())
|
||||
? d->getEnvironment()
|
||||
: env;
|
||||
// If we will not set any environment variables, we can leave out the shell executable
|
||||
// as the "ssh ..." call will automatically launch the default shell if there are
|
||||
// no arguments. But if we will set environment variables, we need to explicitly
|
||||
// specify the shell executable.
|
||||
const QString shell = finalEnv.hasChanges() ? finalEnv.value_or("SHELL", "/bin/sh")
|
||||
: QString();
|
||||
const QString shell = env.hasChanges() ? env.value_or("SHELL", "/bin/sh") : QString();
|
||||
|
||||
proc->setCommand({filePath(shell), {}});
|
||||
proc->setTerminalMode(TerminalMode::On);
|
||||
|
||||
Reference in New Issue
Block a user