summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestUpdateHandler.cxx
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2015-04-09 18:56:43 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-13 12:59:34 (GMT)
commita198839a7b110a47d76d47e342b1c63f908e6878 (patch)
tree64a03ec951d59b32d9ba4c6243a5bf072505cb20 /Source/CTest/cmCTestUpdateHandler.cxx
parent48040c19d5f1bcec55a130fcf8f8d83db27291b4 (diff)
downloadCMake-a198839a7b110a47d76d47e342b1c63f908e6878.zip
CMake-a198839a7b110a47d76d47e342b1c63f908e6878.tar.gz
CMake-a198839a7b110a47d76d47e342b1c63f908e6878.tar.bz2
CTest: Fix locale used for VCS updates
6a661f06030b85b4484733375bbb0aa23eca7446 fixed the locale used for message output but at the same time broke the locale used for filename encodings. This commit preserves LC_CTYPE in the presence of LC_ALL.
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx43
1 files changed, 2 insertions, 41 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index b9da8a0..10927e7 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -21,6 +21,7 @@
#include "cmGeneratedFileStream.h"
#include "cmXMLParser.h"
#include "cmXMLSafe.h"
+#include "cmCLocaleEnvironmentScope.h"
#include "cmCTestVC.h"
#include "cmCTestCVS.h"
@@ -66,46 +67,6 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type)
return cmCTestUpdateHandlerUpdateStrings[type];
}
-class cmCTestUpdateHandlerLocale
-{
-public:
- cmCTestUpdateHandlerLocale();
- ~cmCTestUpdateHandlerLocale();
-private:
- std::string saveLCAll;
-};
-
-cmCTestUpdateHandlerLocale::cmCTestUpdateHandlerLocale()
-{
- const char* lcall = cmSystemTools::GetEnv("LC_ALL");
- if(lcall)
- {
- saveLCAll = lcall;
- }
- // if LC_ALL is not set to C, then
- // set it, so that svn/cvs info will be in english ascii
- if(! (lcall && strcmp(lcall, "C") == 0))
- {
- cmSystemTools::PutEnv("LC_ALL=C");
- }
-}
-
-cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
-{
- // restore the value of LC_ALL after running the version control
- // commands
- if(!saveLCAll.empty())
- {
- std::string put = "LC_ALL=";
- put += saveLCAll;
- cmSystemTools::PutEnv(put);
- }
- else
- {
- cmSystemTools::UnsetEnv("LC_ALL");
- }
-}
-
//----------------------------------------------------------------------
cmCTestUpdateHandler::cmCTestUpdateHandler()
{
@@ -194,7 +155,7 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
int cmCTestUpdateHandler::ProcessHandler()
{
// Make sure VCS tool messages are in English so we can parse them.
- cmCTestUpdateHandlerLocale fixLocale;
+ cmCLocaleEnvironmentScope fixLocale;
static_cast<void>(fixLocale);
// Get source dir