[cmake-commits] king committed cmExecuteProcessCommand.cxx 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 15 17:38:12 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv30386/Source

Modified Files:
	cmExecuteProcessCommand.cxx 
Log Message:
BUG: Work around bug when calling insert on an empty vector of char on midworld. Should eliminate the sporadic failure of EXECUTE_PROCESS during the SimpleInstall-Stage2 test. (david.cole from Brad's checkout on midworld)


Index: cmExecuteProcessCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExecuteProcessCommand.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmExecuteProcessCommand.cxx	16 Oct 2006 15:32:28 -0000	1.8
+++ cmExecuteProcessCommand.cxx	15 Oct 2007 21:38:10 -0000	1.9
@@ -28,6 +28,8 @@
 
 void cmExecuteProcessCommandFixText(std::vector<char>& output,
                                     bool strip_trailing_whitespace);
+void cmExecuteProcessCommandAppend(std::vector<char>& output,
+                                   const char* data, int length);
 
 // cmExecuteProcessCommand
 bool cmExecuteProcessCommand
@@ -305,14 +307,14 @@
         }
       else
         {
-        tempOutput.insert(tempOutput.end(), data, data+length);
+        cmExecuteProcessCommandAppend(tempOutput, data, length);
         }
       }
     else if(p == cmsysProcess_Pipe_STDERR && !error_quiet)
       {
       if(!error_variable.empty())
         {
-        tempError.insert(tempError.end(), data, data+length);
+        cmExecuteProcessCommandAppend(tempError, data, length);
         }
       }
     }
@@ -405,3 +407,21 @@
   // Put a terminator on the text string.
   output.push_back('\0');
 }
+
+//----------------------------------------------------------------------------
+void cmExecuteProcessCommandAppend(std::vector<char>& output,
+                                   const char* data, int length)
+{
+#if defined(__APPLE__)
+  // HACK on Apple to work around bug with inserting at the
+  // end of an empty vector.  This resulted in random failures
+  // that were hard to reproduce.
+  if(output.empty() && length > 0)
+    {
+    output.push_back(data[0]);
+    ++data;
+    --length;
+    }
+#endif
+  output.insert(output.end(), data, data+length);
+}



More information about the Cmake-commits mailing list