diff options
author | Brad King <brad.king@kitware.com> | 2012-04-24 20:24:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-04-24 20:56:14 (GMT) |
commit | b10c5cbb878af541f4ffa35a9e287c31743c6e97 (patch) | |
tree | d812f0b9f60fb650f5f7cbee21bbfe73490f222e /Source/CTest | |
parent | 93e6069553874e11af8915da68996fb4323d4a52 (diff) | |
download | CMake-b10c5cbb878af541f4ffa35a9e287c31743c6e97.zip CMake-b10c5cbb878af541f4ffa35a9e287c31743c6e97.tar.gz CMake-b10c5cbb878af541f4ffa35a9e287c31743c6e97.tar.bz2 |
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.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 81f18b0..c3de5dc 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -671,7 +671,7 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, if (environment && environment->size()>0) { - cmSystemTools::AppendEnv(environment); + cmSystemTools::AppendEnv(*environment); } return this->TestProcess->StartProcess(); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 5841b8d..d3ab2ef 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -643,11 +643,7 @@ int cmCTestScriptHandler::RunCurrentScript() { std::vector<std::string> envArgs; cmSystemTools::ExpandListArgument(this->CTestEnv.c_str(),envArgs); - // for each variable/argument do a putenv - for (unsigned i = 0; i < envArgs.size(); ++i) - { - cmSystemTools::PutEnv(envArgs[i].c_str()); - } + cmSystemTools::AppendEnv(envArgs); } // now that we have done most of the error checking finally run the |