From 790e544689e7f7a906ee291a6715bc6833b15606 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 29 Aug 2025 11:16:11 +0200 Subject: [PATCH] config: update environment if cfg changes live (#11508) --- src/config/ConfigManager.cpp | 10 +++++++--- 1 file 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 CConfigManager::handleSource(const std::string& comma } std::optional 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') {