summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-01-14 21:11:00 (GMT)
committerBrad King <brad.king@kitware.com>2016-01-19 20:51:00 (GMT)
commitce3b713baa1c899ae7739c192040e24445368a0a (patch)
treebcdb50ab7b1338a9a793c9212fc7d3add8222e3d
parentdc039cc02c857b2c418481533a236dad6a586a7f (diff)
downloadCMake-ce3b713baa1c899ae7739c192040e24445368a0a.zip
CMake-ce3b713baa1c899ae7739c192040e24445368a0a.tar.gz
CMake-ce3b713baa1c899ae7739c192040e24445368a0a.tar.bz2
cmSystemTools: Simplify RunSingleCommand output string construction
Assign to the result strings instead setting to empty and appending. The old approach was left from when we directly buffered output in the strings.
-rw-r--r--Source/cmSystemTools.cxx17
1 files changed, 4 insertions, 13 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2b0c2ed..3a730b2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -660,14 +660,6 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
argv.push_back(a->c_str());
}
argv.push_back(0);
- if ( captureStdOut )
- {
- *captureStdOut = "";
- }
- if (captureStdErr && captureStdErr != captureStdOut)
- {
- *captureStdErr = "";
- }
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());
@@ -745,14 +737,13 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
}
cmsysProcess_WaitForExit(cp, 0);
- if ( captureStdOut && tempStdOut.begin() != tempStdOut.end())
+ if (captureStdOut)
{
- captureStdOut->append(&*tempStdOut.begin(), tempStdOut.size());
+ captureStdOut->assign(tempStdOut.begin(), tempStdOut.end());
}
- if ( captureStdErr && captureStdErr != captureStdOut &&
- tempStdErr.begin() != tempStdErr.end())
+ if (captureStdErr && captureStdErr != captureStdOut)
{
- captureStdErr->append(&*tempStdErr.begin(), tempStdErr.size());
+ captureStdErr->assign(tempStdErr.begin(), tempStdErr.end());
}
bool result = true;