aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2025-04-11 15:33:58 +0200
committerhjk <[email protected]>2025-04-15 09:09:46 +0000
commit0503f267e282f327f27067e50db657d6b6e5dd7a (patch)
treeed1a65442f0388135b3758f2b4ec542e91c41580
parentddb8adc53129a27378bcc81cf7ac621fb274c353 (diff)
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 <[email protected]>
-rw-r--r--src/plugins/remotelinux/linuxdevice.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp
index 7fd2ef51db3..b446de70793 100644
--- a/src/plugins/remotelinux/linuxdevice.cpp
+++ b/src/plugins/remotelinux/linuxdevice.cpp
@@ -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();