summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-11-26 16:41:57 (GMT)
committerBrad King <brad.king@kitware.com>2003-11-26 16:41:57 (GMT)
commit945fcb581d2c8f21bd9bc077ccf505ee058fa81d (patch)
tree12aaa78d0f6ef3707b1abe3240d5f6bbbadd108e /Source/cmSystemTools.cxx
parent6018ebdc8558573aa307334f3b6d9a91aa3be533 (diff)
downloadCMake-945fcb581d2c8f21bd9bc077ccf505ee058fa81d.zip
CMake-945fcb581d2c8f21bd9bc077ccf505ee058fa81d.tar.gz
CMake-945fcb581d2c8f21bd9bc077ccf505ee058fa81d.tar.bz2
BUG: Do not use std::string to accumulate output. Use std::vector instead. This is much better at memory management.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1e2de6e..1d12ac9 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -400,6 +400,7 @@ bool cmSystemTools::RunSingleCommand(
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
+ std::vector<char> tempOutput;
char* data;
int length;
while(cmsysProcess_WaitForData(cp, (cmsysProcess_Pipe_STDOUT |
@@ -408,7 +409,7 @@ bool cmSystemTools::RunSingleCommand(
{
if ( output )
{
- output->append(data, length);
+ tempOutput.insert(tempOutput.end(), data, data+length);
}
if(verbose)
{
@@ -417,6 +418,10 @@ bool cmSystemTools::RunSingleCommand(
}
cmsysProcess_WaitForExit(cp, 0);
+ if ( output )
+ {
+ output->append(&*tempOutput.begin(), tempOutput.size());
+ }
bool result = true;
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)