diff options
author | Brad King <brad.king@kitware.com> | 2018-01-26 13:27:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-26 13:27:37 (GMT) |
commit | f343106b19eec139764dc965f9110f503aafbf9c (patch) | |
tree | 2ad40ae416e4db8bad3c005f4650ad4d2c56f61c /Source/cmSystemTools.cxx | |
parent | b50fb70be8eb629083eb2ad2e0b413793bbdde06 (diff) | |
parent | e6a80ccfc440ac8dd5e9e5405744c2423560fc02 (diff) | |
download | CMake-f343106b19eec139764dc965f9110f503aafbf9c.zip CMake-f343106b19eec139764dc965f9110f503aafbf9c.tar.gz CMake-f343106b19eec139764dc965f9110f503aafbf9c.tar.bz2 |
Merge topic 'ctest-chrono'
e6a80ccf Make use of std::chrono throughout every component
ff62b005 CTest: add safe conversion from cmDuration to integer types
695951bc CTest: introduce cmDuration
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1592
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ce08465..323131a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3,6 +3,7 @@ #include "cmSystemTools.h" #include "cmAlgorithms.h" +#include "cmDuration.h" #include "cmProcessOutput.h" #include "cm_sys_stat.h" @@ -701,7 +702,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command, std::string* captureStdOut, std::string* captureStdErr, int* retVal, const char* dir, OutputOption outputflag, - double timeout, Encoding encoding) + cmDuration timeout, Encoding encoding) { std::vector<const char*> argv; argv.reserve(command.size() + 1); @@ -729,7 +730,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command, } assert(!captureStdErr || captureStdErr != captureStdOut); - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); std::vector<char> tempStdOut; @@ -842,7 +843,7 @@ bool cmSystemTools::RunSingleCommand(const char* command, std::string* captureStdOut, std::string* captureStdErr, int* retVal, const char* dir, OutputOption outputflag, - double timeout) + cmDuration timeout) { if (s_DisableRunCommandOutput) { outputflag = OUTPUT_NONE; @@ -1828,7 +1829,7 @@ bool cmSystemTools::ListTar(const char* outFileName, bool verbose) } int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, - double timeout, std::vector<char>& out, + cmDuration timeout, std::vector<char>& out, std::vector<char>& err) { line.clear(); @@ -1876,7 +1877,9 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, // No newlines found. Wait for more data from the process. int length; char* data; - int pipe = cmsysProcess_WaitForData(process, &data, &length, &timeout); + double timeoutAsDbl = timeout.count(); + int pipe = + cmsysProcess_WaitForData(process, &data, &length, &timeoutAsDbl); if (pipe == cmsysProcess_Pipe_Timeout) { // Timeout has been exceeded. return pipe; |