summaryrefslogtreecommitdiffstats
path: root/Source/cmExecuteProcessCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-10-15 21:38:10 (GMT)
committerBrad King <brad.king@kitware.com>2007-10-15 21:38:10 (GMT)
commit583aff257700b0de3f467a76abc182cead34dd2d (patch)
treef243b9a5491e02c3cb23c7c75297c3323de15e37 /Source/cmExecuteProcessCommand.cxx
parentb63ff2fb6f9e73c4d909c4b7fd5d07b25f916ce3 (diff)
downloadCMake-583aff257700b0de3f467a76abc182cead34dd2d.zip
CMake-583aff257700b0de3f467a76abc182cead34dd2d.tar.gz
CMake-583aff257700b0de3f467a76abc182cead34dd2d.tar.bz2
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)
Diffstat (limited to 'Source/cmExecuteProcessCommand.cxx')
-rw-r--r--Source/cmExecuteProcessCommand.cxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 767690f..c437ac9 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -28,6 +28,8 @@ static bool cmExecuteProcessCommandIsWhitespace(char c)
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 @@ bool cmExecuteProcessCommand
}
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 @@ void cmExecuteProcessCommandFixText(std::vector<char>& output,
// 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);
+}