diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/local/config.hpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/buildtool/execution_api/local/config.hpp b/src/buildtool/execution_api/local/config.hpp index 10d36a79..92d6606a 100644 --- a/src/buildtool/execution_api/local/config.hpp +++ b/src/buildtool/execution_api/local/config.hpp @@ -30,17 +30,11 @@ /// \brief Store global build system configuration. class LocalExecutionConfig { - struct ConfigData { - // Launcher to be prepended to action's command before executed. - // Default: ["env", "--"] - std::vector<std::string> launcher{"env", "--"}; - }; - public: [[nodiscard]] static auto SetLauncher( std::vector<std::string> const& launcher) noexcept -> bool { try { - Data().launcher = launcher; + Instance().launcher_ = launcher; } catch (std::exception const& e) { Logger::Log(LogLevel::Error, "when setting the local launcher\n{}", @@ -52,14 +46,18 @@ class LocalExecutionConfig { [[nodiscard]] static auto GetLauncher() noexcept -> std::vector<std::string> { - return Data().launcher; + return Instance().launcher_; } - private: - [[nodiscard]] static auto Data() noexcept -> ConfigData& { - static ConfigData instance{}; - return instance; + [[nodiscard]] static auto Instance() noexcept -> LocalExecutionConfig& { + static LocalExecutionConfig config; + return config; } + + private: + // Launcher to be prepended to action's command before executed. + // Default: ["env", "--"] + std::vector<std::string> launcher_ = {"env", "--"}; }; #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_LOCAL_CONFIG_HPP |