浏览代码

ENH: play it safe and restore the value of LC_MESSAGES

Bill Hoffman 17 年之前
父节点
当前提交
74e606a270
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 17 1
      Source/CTest/cmCTestUpdateHandler.cxx

+ 17 - 1
Source/CTest/cmCTestUpdateHandler.cxx

@@ -253,7 +253,12 @@ int cmCTestUpdateHandler::ProcessHandler()
   std::string errors;
 
   // make sure 
+  std::string saveLCMessages;
   const char* lcmess = cmSystemTools::GetEnv("LC_MESSAGES");
+  if(lcmess)
+    {
+    saveLCMessages = lcmess;
+    }
   // if LC_MESSAGES is not set to en_EN, then 
   // set it, so that svn/cvs info will be in english
   if(! (lcmess && strcmp(lcmess, "en_EN") == 0))
@@ -1110,7 +1115,18 @@ int cmCTestUpdateHandler::ProcessHandler()
     }
   os << "</UpdateReturnStatus>" << std::endl;
   os << "</Update>" << std::endl;
-
+  // restore the value of LC_MESSAGES after running the version control
+  // commands
+  if(saveLCMessages.size())
+    {
+    std::string put = "LC_MESSAGES=";
+    put += saveLCMessages;
+    cmSystemTools::PutEnv(put.c_str());
+    }
+  else
+    {
+    cmSystemTools::UnsetEnv("LC_MESSAGES");
+    }
   if (! res  )
     {
     cmCTestLog(this->CTest, ERROR_MESSAGE,