mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 12:19:54 -05:00
CTest: Simplify environment save/restore
Replace use of AppendEnv/RestoreEnv pairs with instances of SaveRestoreEnvironment. Simplify the signature of AppendEnv and use it in place of similar loops elsewhere. Move the RestoreEnv implementation inside the SaveRestoreEnvironment destructor which is the only place left that calls it.
This commit is contained in:
+2
-10
@@ -371,16 +371,8 @@ public:
|
||||
/** Get the list of all environment variables */
|
||||
static std::vector<std::string> GetEnvironmentVariables();
|
||||
|
||||
/** Append multiple variables to the current environment.
|
||||
Return the original environment, as it was before the
|
||||
append. */
|
||||
static std::vector<std::string> AppendEnv(
|
||||
std::vector<std::string>* env);
|
||||
|
||||
/** Restore the full environment to "env" - use after
|
||||
AppendEnv to put the environment back to the way it
|
||||
was. */
|
||||
static void RestoreEnv(const std::vector<std::string>& env);
|
||||
/** Append multiple variables to the current environment. */
|
||||
static void AppendEnv(std::vector<std::string> const& env);
|
||||
|
||||
/** Helper class to save and restore the environment.
|
||||
Instantiate this class as an automatic variable on
|
||||
|
||||
Reference in New Issue
Block a user