diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2017-03-01 18:41:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-06 15:38:58 (GMT) |
commit | aba92ffd92bb1cc4bbe898b7abe65347b0468d33 (patch) | |
tree | 7fff657ef3fe0dd115886283b808025cfa8faa34 /Source/CTest/cmCTestHandlerCommand.cxx | |
parent | 047a5e4d6656f362151b855b34c259708b8419ba (diff) | |
download | CMake-aba92ffd92bb1cc4bbe898b7abe65347b0468d33.zip CMake-aba92ffd92bb1cc4bbe898b7abe65347b0468d33.tar.gz CMake-aba92ffd92bb1cc4bbe898b7abe65347b0468d33.tar.bz2 |
cmWorkingDirectory: use the new class
These functions just need to change the directory for a block of code
and then go back to the caller's expected location. Use
cmWorkingDirectory to ensure that all return paths are handled.
Diffstat (limited to 'Source/CTest/cmCTestHandlerCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestHandlerCommand.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 2a67d47..c99e450 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -6,6 +6,7 @@ #include "cmCTestGenericHandler.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include "cmake.h" #include <sstream> @@ -216,8 +217,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, handler->SetSubmitIndex(atoi(this->Values[ct_SUBMIT_INDEX])); } } - std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory( + cmWorkingDirectory workdir( this->CTest->GetCTestConfiguration("BuildDirectory")); int res = handler->ProcessHandler(); if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) { @@ -243,7 +243,6 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR], returnString); } - cmSystemTools::ChangeDirectory(current_dir); return true; } |