forked from qt-creator/qt-creator
Linuxdevice: Remove profile sourcing when fetching environment
SshProcessInterfacePrivate::fullLocalCommandLine() will already add the sourcing itself. No need to add it manually again. Fixes QNX devices mostly. Change-Id: I552a432f5adf367318444e6c6dff815fed67d9a7 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -378,21 +378,17 @@ Environment LinuxDevicePrivate::getEnvironment()
|
||||
if (m_disconnected())
|
||||
return {};
|
||||
|
||||
const bool sourceProfile = q->extraData(Constants::SourceProfile).toBool();
|
||||
|
||||
CommandLine cmd;
|
||||
if (sourceProfile) {
|
||||
cmd.setExecutable(q->filePath("sh"));
|
||||
cmd.addArgs({"-c", ". /etc/profile ; . ~/.profile ; env"});
|
||||
} else {
|
||||
cmd.setExecutable(q->filePath("env"));
|
||||
}
|
||||
|
||||
Process getEnvProc;
|
||||
getEnvProc.setCommand(cmd);
|
||||
getEnvProc.setCommand({q->filePath("env"), {}});
|
||||
using namespace std::chrono;
|
||||
getEnvProc.runBlocking(5s);
|
||||
|
||||
if (getEnvProc.result() != ProcessResult::FinishedWithSuccess) {
|
||||
qCWarning(linuxDeviceLog) << "Failed to get environment variables from device:"
|
||||
<< getEnvProc.exitMessage() << getEnvProc.allOutput();
|
||||
return {};
|
||||
}
|
||||
|
||||
const QString remoteOutput = getEnvProc.cleanedStdOut();
|
||||
m_environmentCache = Environment(remoteOutput.split('\n', Qt::SkipEmptyParts), q->osType());
|
||||
return m_environmentCache.value();
|
||||
|
Reference in New Issue
Block a user