summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-08-29 11:16:11 +0200
committerGitHub <noreply@github.com>2025-08-29 11:16:11 +0200
commit790e544689e7f7a906ee291a6715bc6833b15606 (patch)
tree448cf76b6d727f4db3526494ce4fc5914c1663ed /src
parenta209f9911ceb83e17a3fc0269ebea1a7d8587784 (diff)
config: update environment if cfg changes live (#11508)
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 27f3b5d5..3e75f2ab 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -3107,14 +3107,18 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma
}
std::optional<std::string> CConfigManager::handleEnv(const std::string& command, const std::string& value) {
- if (!m_isFirstLaunch)
- return {};
-
const auto ARGS = CVarList(value, 2);
if (ARGS[0].empty())
return "env empty";
+ if (!m_isFirstLaunch) {
+ // check if env changed at all. If it didn't, ignore. If it did, update it.
+ const auto* ENV = getenv(ARGS[0].c_str());
+ if (ENV && ENV == ARGS[1])
+ return {}; // env hasn't changed
+ }
+
setenv(ARGS[0].c_str(), ARGS[1].c_str(), 1);
if (command.back() == 'd') {