diff options
author | Wouter Klouwen <wouter.klouwen@youview.com> | 2018-01-20 15:13:21 (GMT) |
---|---|---|
committer | Wouter Klouwen <wouter.klouwen@youview.com> | 2018-01-23 18:56:42 (GMT) |
commit | e6a80ccfc440ac8dd5e9e5405744c2423560fc02 (patch) | |
tree | 22b68d9379421a8a84ff5dab35e9689654334b04 /Source/cmSystemTools.cxx | |
parent | ff62b00522d1ddaeb88be241ab4a022f935b5c00 (diff) | |
download | CMake-e6a80ccfc440ac8dd5e9e5405744c2423560fc02.zip CMake-e6a80ccfc440ac8dd5e9e5405744c2423560fc02.tar.gz CMake-e6a80ccfc440ac8dd5e9e5405744c2423560fc02.tar.bz2 |
Make use of std::chrono throughout every component
This commit continues the changes made in CTest to support std::chrono
by
applying it throughout every component where a duration was used.
No functional change intended.
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 c321236..d7ff58c 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" @@ -699,7 +700,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); @@ -727,7 +728,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; @@ -840,7 +841,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; @@ -1811,7 +1812,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(); @@ -1859,7 +1860,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; |