summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx13
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx7
-rw-r--r--Source/CPack/cmCPackGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx19
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx7
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx7
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx16
-rw-r--r--Source/cmGlobalGenerator.cxx5
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmQtAutoGenInitializer.cxx5
-rw-r--r--Source/cmSystemTools.cxx13
-rw-r--r--Source/cmSystemTools.h7
-rw-r--r--Source/cmTryRunCommand.cxx4
-rw-r--r--Source/cmake.cxx5
-rw-r--r--Source/cmakexbuild.cxx7
-rw-r--r--Source/cmcmd.cxx4
18 files changed, 86 insertions, 62 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 86c6981..9f1a15e 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -9,6 +9,7 @@
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
#include "cmCPackLog.h" // IWYU pragma: keep
+#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
@@ -84,9 +85,9 @@ int cmCPackIFWGenerator::PackageFiles()
std::string output;
int retVal = 1;
cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
- bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
- &output, &retVal, nullptr,
- this->GeneratorVerbose, 0);
+ bool res = cmSystemTools::RunSingleCommand(
+ ifwCmd.c_str(), &output, &output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
if (!res || retVal) {
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
ofs << "# Run command: " << ifwCmd << std::endl
@@ -194,9 +195,9 @@ int cmCPackIFWGenerator::PackageFiles()
std::string output;
int retVal = 1;
cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
- bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
- &output, &retVal, nullptr,
- this->GeneratorVerbose, 0);
+ bool res = cmSystemTools::RunSingleCommand(
+ ifwCmd.c_str(), &output, &output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
if (!res || retVal) {
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
ofs << "# Run command: " << ifwCmd << std::endl
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index bb35623..e95b96df 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
+#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
@@ -242,9 +243,9 @@ bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command,
{
int exit_code = 1;
- bool result = cmSystemTools::RunSingleCommand(command.str().c_str(), output,
- output, &exit_code, nullptr,
- this->GeneratorVerbose, 0);
+ bool result = cmSystemTools::RunSingleCommand(
+ command.str().c_str(), output, output, &exit_code, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
if (!result || exit_code) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error executing: " << command.str()
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index ea0e899..9590aa2 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmCryptoHash.h"
+#include "cmDuration.h"
#include "cmFSPermissions.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
@@ -277,9 +278,9 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
std::string output;
int retVal = 1;
- bool resB =
- cmSystemTools::RunSingleCommand(ic.c_str(), &output, &output, &retVal,
- nullptr, this->GeneratorVerbose, 0);
+ bool resB = cmSystemTools::RunSingleCommand(
+ ic.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
+ cmDuration::zero());
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/InstallOutput.log";
@@ -601,7 +602,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
int retVal = 1;
bool resB = cmSystemTools::RunSingleCommand(
buildCommand.c_str(), &output, &output, &retVal,
- installDirectory.c_str(), this->GeneratorVerbose, 0);
+ installDirectory.c_str(), this->GeneratorVerbose,
+ cmDuration::zero());
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/PreinstallOutput.log";
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index ddf104c..965283d 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -5,6 +5,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
+#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
@@ -301,9 +302,9 @@ int cmCPackNSISGenerator::PackageFiles()
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
std::string output;
int retVal = 1;
- bool res =
- cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
- nullptr, this->GeneratorVerbose, 0);
+ bool res = cmSystemTools::RunSingleCommand(
+ nsisCmd.c_str(), &output, &output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << nsisCmd << std::endl
@@ -400,9 +401,9 @@ int cmCPackNSISGenerator::InitializeInternal()
<< std::endl);
std::string output;
int retVal = 1;
- bool resS =
- cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
- nullptr, this->GeneratorVerbose, 0);
+ bool resS = cmSystemTools::RunSingleCommand(
+ nsisCmd.c_str(), &output, &output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
if (!resS || retVal ||
@@ -737,9 +738,9 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
zipListFileName.c_str());
std::string output;
int retVal = -1;
- int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retVal, dirName.c_str(),
- cmSystemTools::OUTPUT_NONE, 0);
+ int res = cmSystemTools::RunSingleCommand(
+ cmd.c_str(), &output, &output, &retVal, dirName.c_str(),
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero());
if (!res || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressZip.log";
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 8d3c40c..e750de3 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -6,6 +6,7 @@
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
+#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cm_sys_stat.h"
@@ -154,9 +155,9 @@ int cmCPackOSXX11Generator::PackageFiles()
int numTries = 10;
bool res = false;
while (numTries > 0) {
- res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
- &output, &retVal, nullptr,
- this->GeneratorVerbose, 0);
+ res = cmSystemTools::RunSingleCommand(
+ dmgCmd.str().c_str(), &output, &output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
if (res && !retVal) {
numTries = -1;
break;
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index dbcb022..c515b85 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
+#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
@@ -295,9 +296,9 @@ int cmCPackPackageMakerGenerator::PackageFiles()
int numTries = 10;
bool res = false;
while (numTries > 0) {
- res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
- &output, &retVal, nullptr,
- this->GeneratorVerbose, 0);
+ res = cmSystemTools::RunSingleCommand(
+ dmgCmd.str().c_str(), &output, &output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
if (res && !retVal) {
numTries = -1;
break;
@@ -467,7 +468,8 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command,
std::string output;
int retVal = 1;
bool res = cmSystemTools::RunSingleCommand(
- command, &output, &output, &retVal, nullptr, this->GeneratorVerbose, 0);
+ command, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
+ cmDuration::zero());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker"
<< std::endl);
if (!res || retVal) {
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index 6a6dc82..57cf7ea 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -8,6 +8,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
+#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
@@ -145,9 +146,9 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl);
std::string output, error_output;
int retVal = 1;
- bool res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
- &error_output, &retVal, nullptr,
- this->GeneratorVerbose, 0);
+ bool res = cmSystemTools::RunSingleCommand(
+ command.c_str(), &output, &error_output, &retVal, nullptr,
+ this->GeneratorVerbose, cmDuration::zero());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl);
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile.c_str());
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 3383c9d..81089ca 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -251,7 +251,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
int retVal = cm.GetGlobalGenerator()->Build(
this->SourceDir, this->BinaryDir, this->BuildProject, tar, output,
this->BuildMakeProgram, config, !this->BuildNoClean, false, false,
- remainingTime.count());
+ remainingTime);
out << output;
// if the build failed then return
if (retVal) {
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 15a81f2..78ab5ff 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -27,6 +27,7 @@
#include "cmCTestTestCommand.h"
#include "cmCTestUpdateCommand.h"
#include "cmCTestUploadCommand.h"
+#include "cmDuration.h"
#include "cmFunctionBlocker.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
@@ -206,7 +207,8 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
std::vector<char> out;
std::vector<char> err;
std::string line;
- int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
+ int pipe =
+ cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out, err);
while (pipe != cmsysProcess_Pipe_None) {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Output: " << line
<< "\n");
@@ -215,7 +217,8 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, line << "\n");
}
- pipe = cmSystemTools::WaitForLine(cp, line, 100, out, err);
+ pipe = cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out,
+ err);
}
// Properly handle output of the build command
@@ -601,7 +604,8 @@ int cmCTestScriptHandler::CheckOutSourceDir()
"Run cvs: " << this->CVSCheckOut << std::endl);
res = cmSystemTools::RunSingleCommand(
this->CVSCheckOut.c_str(), &output, &output, &retVal,
- this->CTestRoot.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/);
+ this->CTestRoot.c_str(), this->HandlerVerbose,
+ cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
cmSystemTools::Error("Unable to perform cvs checkout:\n",
output.c_str());
@@ -668,7 +672,7 @@ int cmCTestScriptHandler::PerformExtraUpdates()
"Run Update: " << fullCommand << std::endl);
res = cmSystemTools::RunSingleCommand(
fullCommand.c_str(), &output, &output, &retVal, cvsArgs[0].c_str(),
- this->HandlerVerbose, 0 /*this->TimeOut*/);
+ this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(),
"\nWith output:\n", output.c_str());
@@ -772,7 +776,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
"Run cmake command: " << command << std::endl);
res = cmSystemTools::RunSingleCommand(
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
- this->HandlerVerbose, 0 /*this->TimeOut*/);
+ this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!this->CMOutFile.empty()) {
std::string cmakeOutputFile = this->CMOutFile;
@@ -811,7 +815,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
"Run ctest command: " << command << std::endl);
res = cmSystemTools::RunSingleCommand(
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
- this->HandlerVerbose, 0 /*this->TimeOut*/);
+ this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
// did something critical fail in ctest
if (!res || cmakeFailed || retVal & cmCTest::BUILD_ERRORS) {
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 47a9390..59158b0 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -21,6 +21,7 @@
#include "cmComputeTargetDepends.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
+#include "cmDuration.h"
#include "cmExportBuildFileGenerator.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmGeneratedFileStream.h"
@@ -87,7 +88,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->InstallTargetEnabled = false;
// how long to let try compiles run
- this->TryCompileTimeout = 0;
+ this->TryCompileTimeout = cmDuration::zero();
this->ExtraGenerator = nullptr;
this->CurrentConfigureMakefile = nullptr;
@@ -1801,7 +1802,7 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/,
const std::string& target, std::string& output,
const std::string& makeCommandCSTR,
const std::string& config, bool clean, bool fast,
- bool verbose, double timeout,
+ bool verbose, cmDuration timeout,
cmSystemTools::OutputOption outputflag,
std::vector<std::string> const& nativeOptions)
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 3ebff82..34ed5b0 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -14,6 +14,7 @@
#include <vector>
#include "cmCustomCommandLines.h"
+#include "cmDuration.h"
#include "cmExportSetMap.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
@@ -160,8 +161,8 @@ public:
const std::string& projectName, const std::string& targetName,
std::string& output, const std::string& makeProgram,
const std::string& config, bool clean, bool fast, bool verbose,
- double timeout, cmSystemTools::OutputOption outputflag =
- cmSystemTools::OUTPUT_NONE,
+ cmDuration timeout, cmSystemTools::OutputOption outputflag =
+ cmSystemTools::OUTPUT_NONE,
std::vector<std::string> const& nativeOptions =
std::vector<std::string>());
@@ -233,7 +234,7 @@ public:
void EnableInstallTarget();
- int TryCompileTimeout;
+ cmDuration TryCompileTimeout;
bool GetForceUnixPaths() const { return this->ForceUnixPaths; }
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 0b67981..d845e8b 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -6,6 +6,7 @@
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
+#include "cmDuration.h"
#include "cmFilePathChecksum.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -410,7 +411,7 @@ void cmQtAutoGenInitializer::InitCustomTargets()
int retVal = 0;
bool result = cmSystemTools::RunSingleCommand(
command, &rccStdOut, &rccStdErr, &retVal, nullptr,
- cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
if (result && retVal == 0 &&
rccStdOut.find("--list") != std::string::npos) {
this->RccListOptions.push_back("--list");
@@ -1417,7 +1418,7 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
cmd.push_back(fileNameName);
result = cmSystemTools::RunSingleCommand(
cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
- cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
}
if (!result || retVal) {
error = "rcc list process failed for:\n ";
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;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d29ba56..77e34b4 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCryptoHash.h"
+#include "cmDuration.h"
#include "cmProcessOutput.h"
#include "cmsys/Process.h"
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
@@ -225,7 +226,7 @@ public:
int* retVal = nullptr,
const char* dir = nullptr,
OutputOption outputflag = OUTPUT_MERGE,
- double timeout = 0.0);
+ cmDuration timeout = cmDuration::zero());
/**
* In this version of RunSingleCommand, command[0] should be
* the command to run, and each argument to the command should
@@ -237,7 +238,7 @@ public:
int* retVal = nullptr,
const char* dir = nullptr,
OutputOption outputflag = OUTPUT_MERGE,
- double timeout = 0.0,
+ cmDuration timeout = cmDuration::zero(),
Encoding encoding = cmProcessOutput::Auto);
static std::string PrintSingleCommand(std::vector<std::string> const&);
@@ -343,7 +344,7 @@ public:
/** a general output handler for cmsysProcess */
static int WaitForLine(cmsysProcess* process, std::string& line,
- double timeout, std::vector<char>& out,
+ cmDuration timeout, std::vector<char>& out,
std::vector<char>& err);
/** Split a string on its newlines into multiple lines. Returns
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 932b976..94edf93 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -5,6 +5,7 @@
#include "cmsys/FStream.hxx"
#include <stdio.h>
+#include "cmDuration.h"
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateTypes.h"
@@ -185,10 +186,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
if (!runArgs.empty()) {
finalCommand += runArgs;
}
- int timeout = 0;
bool worked = cmSystemTools::RunSingleCommand(
finalCommand.c_str(), out, out, &retVal, nullptr,
- cmSystemTools::OUTPUT_NONE, timeout);
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero());
// set the run var
char retChar[16];
const char* retStr;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 480646e..48e3ddf 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -7,6 +7,7 @@
#include "cmDocumentation.h"
#include "cmDocumentationEntry.h"
#include "cmDocumentationFormatter.h"
+#include "cmDuration.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileTimeComparison.h"
#include "cmGeneratorTarget.h"
@@ -2475,8 +2476,8 @@ int cmake::Build(const std::string& dir, const std::string& target,
#endif
return gen->Build("", dir, projName, target, output, "", config, clean,
- false, verbose, 0, cmSystemTools::OUTPUT_PASSTHROUGH,
- nativeOptions);
+ false, verbose, cmDuration::zero(),
+ cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions);
}
bool cmake::Open(const std::string& dir, bool dryRun)
diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx
index 20ead47..2951945 100644
--- a/Source/cmakexbuild.cxx
+++ b/Source/cmakexbuild.cxx
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "cmDuration.h"
#include "cmSystemTools.h"
// This is a wrapper program for xcodebuild
@@ -27,7 +28,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
std::vector<char> out;
std::vector<char> err;
std::string line;
- int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
+ int pipe =
+ cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out, err);
while (pipe != cmsysProcess_Pipe_None) {
if (line.find("/bin/sh: bad interpreter: Text file busy") !=
std::string::npos) {
@@ -45,7 +47,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
std::cout << line << "\n";
}
}
- pipe = cmSystemTools::WaitForLine(cp, line, 100, out, err);
+ pipe = cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out,
+ err);
}
cmsysProcess_WaitForExit(cp, nullptr);
if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 2c3bda2..70e4fde 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -3,6 +3,7 @@
#include "cmcmd.h"
#include "cmAlgorithms.h"
+#include "cmDuration.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -797,10 +798,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::string command =
cmWrap('"', cmMakeRange(args).advance(3), '"', " ");
int retval = 0;
- int timeout = 0;
if (cmSystemTools::RunSingleCommand(
command.c_str(), nullptr, nullptr, &retval, directory.c_str(),
- cmSystemTools::OUTPUT_PASSTHROUGH, timeout)) {
+ cmSystemTools::OUTPUT_PASSTHROUGH, cmDuration::zero())) {
return retval;
}