Commit 695951bc authored by Wouter Klouwen's avatar Wouter Klouwen Committed by Brad King
Browse files

CTest: introduce cmDuration

This commit introduces cmDuration as a typedef for
std::chrono::duration<double, std::ratio<1>>. It is less verbose and
provides for a point to put future common functionality for durations.

No functional change intended.
parent 9c52b587
......@@ -19,7 +19,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
this->BuildTwoConfig = false;
this->BuildNoClean = false;
this->BuildNoCMake = false;
this->Timeout = std::chrono::duration<double>::zero();
this->Timeout = cmDuration::zero();
}
void cmCTestBuildAndTestHandler::Initialize()
......@@ -224,8 +224,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
this->BuildTargets.push_back("");
}
for (std::string const& tar : this->BuildTargets) {
std::chrono::duration<double> remainingTime = std::chrono::seconds(0);
if (this->Timeout > std::chrono::duration<double>::zero()) {
cmDuration remainingTime = std::chrono::seconds(0);
if (this->Timeout > cmDuration::zero()) {
remainingTime =
this->Timeout - (std::chrono::steady_clock::now() - clock_start);
if (remainingTime <= std::chrono::seconds(0)) {
......@@ -323,8 +323,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
out << "\n";
// how much time is remaining
std::chrono::duration<double> remainingTime = std::chrono::seconds(0);
if (this->Timeout > std::chrono::duration<double>::zero()) {
cmDuration remainingTime = std::chrono::seconds(0);
if (this->Timeout > cmDuration::zero()) {
remainingTime =
this->Timeout - (std::chrono::steady_clock::now() - clock_start);
if (remainingTime <= std::chrono::seconds(0)) {
......@@ -395,7 +395,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
}
if (currentArg.find("--test-timeout", 0) == 0 && idx < allArgs.size() - 1) {
idx++;
this->Timeout = std::chrono::duration<double>(atof(allArgs[idx].c_str()));
this->Timeout = cmDuration(atof(allArgs[idx].c_str()));
}
if (currentArg == "--build-generator" && idx < allArgs.size() - 1) {
idx++;
......
......@@ -6,8 +6,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
#include <chrono>
#include <sstream>
#include <stddef.h>
#include <string>
......@@ -68,7 +68,7 @@ protected:
std::vector<std::string> TestCommandArgs;
std::vector<std::string> BuildTargets;
bool BuildNoCMake;
std::chrono::duration<double> Timeout;
cmDuration Timeout;
};
#endif
......@@ -4,6 +4,7 @@
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmDuration.h"
#include "cmFileTimeComparison.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
......@@ -633,8 +634,8 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
}
}
void cmCTestBuildHandler::GenerateXMLFooter(
cmXMLWriter& xml, std::chrono::duration<double> elapsed_build_time)
void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml,
cmDuration elapsed_build_time)
{
xml.StartElement("Log");
xml.Attribute("Encoding", "base64");
......
......@@ -7,6 +7,7 @@
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
#include "cmProcessOutput.h"
#include "cmsys/RegularExpression.hxx"
#include <chrono>
......@@ -87,8 +88,7 @@ private:
void GenerateXMLHeader(cmXMLWriter& xml);
void GenerateXMLLaunched(cmXMLWriter& xml);
void GenerateXMLLogScraped(cmXMLWriter& xml);
void GenerateXMLFooter(cmXMLWriter& xml,
std::chrono::duration<double> elapsed_build_time);
void GenerateXMLFooter(cmXMLWriter& xml, cmDuration elapsed_build_time);
bool IsLaunchedErrorFile(const char* fname);
bool IsLaunchedWarningFile(const char* fname);
......
......@@ -3,6 +3,7 @@
#include "cmCTestConfigureHandler.h"
#include "cmCTest.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmXMLWriter.h"
......@@ -62,9 +63,9 @@ int cmCTestConfigureHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Configure with command: " << cCommand << std::endl,
this->Quiet);
res = this->CTest->RunMakeCommand(
cCommand.c_str(), output, &retVal, buildDirectory.c_str(),
std::chrono::duration<double>::zero(), ofs);
res = this->CTest->RunMakeCommand(cCommand.c_str(), output, &retVal,
buildDirectory.c_str(),
cmDuration::zero(), ofs);
if (ofs) {
ofs.close();
......
......@@ -3,6 +3,7 @@
#include "cmCTestCoverageHandler.h"
#include "cmCTest.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmParseBlanketJSCoverage.h"
#include "cmParseCacheCoverage.h"
......@@ -40,7 +41,7 @@ public:
{
this->Process = cmsysProcess_New();
this->PipeState = -1;
this->TimeOut = std::chrono::duration<double>(-1);
this->TimeOut = cmDuration(-1);
}
~cmCTestRunProcess()
{
......@@ -64,7 +65,7 @@ public:
}
}
void SetWorkingDirectory(const char* dir) { this->WorkingDirectory = dir; }
void SetTimeout(std::chrono::duration<double> t) { this->TimeOut = t; }
void SetTimeout(cmDuration t) { this->TimeOut = t; }
bool StartProcess()
{
std::vector<const char*> args;
......@@ -79,7 +80,7 @@ public:
}
cmsysProcess_SetOption(this->Process, cmsysProcess_Option_HideWindow, 1);
if (this->TimeOut >= std::chrono::duration<double>::zero()) {
if (this->TimeOut >= cmDuration::zero()) {
cmsysProcess_SetTimeout(this->Process, this->TimeOut.count());
}
cmsysProcess_Execute(this->Process);
......@@ -108,7 +109,7 @@ private:
cmsysProcess* Process;
std::vector<std::string> CommandLineStrings;
std::string WorkingDirectory;
std::chrono::duration<double> TimeOut;
cmDuration TimeOut;
};
cmCTestCoverageHandler::cmCTestCoverageHandler()
......@@ -1022,9 +1023,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
int retVal = 0;
*cont->OFS << "* Run coverage for: " << fileDir << std::endl;
*cont->OFS << " Command: " << command << std::endl;
int res = this->CTest->RunCommand(
covargs, &output, &errors, &retVal, tempDir.c_str(),
std::chrono::duration<double>::zero() /*this->TimeOut*/);
int res = this->CTest->RunCommand(covargs, &output, &errors, &retVal,
tempDir.c_str(),
cmDuration::zero() /*this->TimeOut*/);
*cont->OFS << " Output: " << output << std::endl;
*cont->OFS << " Errors: " << errors << std::endl;
......@@ -1387,9 +1388,9 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
int retVal = 0;
*cont->OFS << "* Run coverage for: " << fileDir << std::endl;
*cont->OFS << " Command: " << command << std::endl;
int res = this->CTest->RunCommand(
covargs, &output, &errors, &retVal, fileDir.c_str(),
std::chrono::duration<double>::zero() /*this->TimeOut*/);
int res = this->CTest->RunCommand(covargs, &output, &errors, &retVal,
fileDir.c_str(),
cmDuration::zero() /*this->TimeOut*/);
*cont->OFS << " Output: " << output << std::endl;
*cont->OFS << " Errors: " << errors << std::endl;
......
......@@ -25,7 +25,7 @@ cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler)
{
this->CTest = multiHandler.CTest;
this->TestHandler = multiHandler.TestHandler;
this->TestResult.ExecutionTime = std::chrono::duration<double>::zero();
this->TestResult.ExecutionTime = cmDuration::zero();
this->TestResult.ReturnValue = 0;
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = 0;
......@@ -400,7 +400,7 @@ bool cmCTestRunTest::StartTest(size_t total)
// Return immediately if test is disabled
if (this->TestProperties->Disabled) {
this->TestResult.Properties = this->TestProperties;
this->TestResult.ExecutionTime = std::chrono::duration<double>::zero();
this->TestResult.ExecutionTime = cmDuration::zero();
this->TestResult.CompressOutput = false;
this->TestResult.ReturnValue = -1;
this->TestResult.CompletionStatus = "Disabled";
......@@ -415,7 +415,7 @@ bool cmCTestRunTest::StartTest(size_t total)
}
this->TestResult.Properties = this->TestProperties;
this->TestResult.ExecutionTime = std::chrono::duration<double>::zero();
this->TestResult.ExecutionTime = cmDuration::zero();
this->TestResult.CompressOutput = false;
this->TestResult.ReturnValue = -1;
this->TestResult.CompletionStatus = "Failed to start";
......@@ -590,8 +590,7 @@ void cmCTestRunTest::DartProcessing()
}
}
bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut,
bool explicitTimeout,
bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
std::vector<std::string>* environment)
{
this->TestProcess = cm::make_unique<cmProcess>(*this);
......@@ -602,27 +601,25 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut,
this->TestProcess->SetCommandArguments(this->Arguments);
// determine how much time we have
std::chrono::duration<double> timeout =
this->CTest->GetRemainingTimeAllowed();
cmDuration timeout = this->CTest->GetRemainingTimeAllowed();
if (timeout != cmCTest::MaxDuration()) {
timeout -= std::chrono::minutes(2);
}
if (this->CTest->GetTimeOut() > std::chrono::duration<double>::zero() &&
if (this->CTest->GetTimeOut() > cmDuration::zero() &&
this->CTest->GetTimeOut() < timeout) {
timeout = this->CTest->GetTimeOut();
}
if (testTimeOut > std::chrono::duration<double>::zero() &&
if (testTimeOut > cmDuration::zero() &&
testTimeOut < this->CTest->GetRemainingTimeAllowed()) {
timeout = testTimeOut;
}
// always have at least 1 second if we got to here
if (timeout <= std::chrono::duration<double>::zero()) {
if (timeout <= cmDuration::zero()) {
timeout = std::chrono::seconds(1);
}
// handle timeout explicitly set to 0
if (testTimeOut == std::chrono::duration<double>::zero() &&
explicitTimeout) {
timeout = std::chrono::duration<double>::zero();
if (testTimeOut == cmDuration::zero() && explicitTimeout) {
timeout = cmDuration::zero();
}
cmCTestOptionalLog(
this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index
......
......@@ -5,13 +5,13 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <chrono>
#include <set>
#include <stddef.h>
#include <string>
#include <vector>
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
#include "cmProcess.h" // IWYU pragma: keep (for unique_ptr)
class cmCTest;
......@@ -82,8 +82,7 @@ private:
bool NeedsToRerun();
void DartProcessing();
void ExeNotFound(std::string exe);
bool ForkProcess(std::chrono::duration<double> testTimeOut,
bool explicitTimeout,
bool ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
std::vector<std::string>* environment);
void WriteLogOutputTop(size_t completed, size_t total);
// Run post processing of the process output for MemCheck
......
......@@ -558,8 +558,8 @@ int cmCTestScriptHandler::RunCurrentScript()
// for a continuous, do we ned to run it more than once?
if (this->ContinuousDuration >= 0) {
this->UpdateElapsedTime();
auto ending_time = std::chrono::steady_clock::now() +
std::chrono::duration<double>(this->ContinuousDuration);
auto ending_time =
std::chrono::steady_clock::now() + cmDuration(this->ContinuousDuration);
if (this->EmptyBinDirOnce) {
this->EmptyBinDir = true;
}
......@@ -567,8 +567,7 @@ int cmCTestScriptHandler::RunCurrentScript()
auto startOfInterval = std::chrono::steady_clock::now();
result = this->RunConfigurationDashboard();
auto interval = std::chrono::steady_clock::now() - startOfInterval;
auto minimumInterval =
std::chrono::duration<double>(this->MinimumInterval);
auto minimumInterval = cmDuration(this->MinimumInterval);
if (interval < minimumInterval) {
auto sleepTime = std::chrono::duration_cast<std::chrono::seconds>(
minimumInterval - interval)
......@@ -960,7 +959,7 @@ bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
return cmSystemTools::RemoveADirectory(directoryPath);
}
std::chrono::duration<double> cmCTestScriptHandler::GetRemainingTimeAllowed()
cmDuration cmCTestScriptHandler::GetRemainingTimeAllowed()
{
if (!this->Makefile) {
return cmCTest::MaxDuration();
......@@ -972,9 +971,9 @@ std::chrono::duration<double> cmCTestScriptHandler::GetRemainingTimeAllowed()
return cmCTest::MaxDuration();
}
auto timelimit = std::chrono::duration<double>(atof(timelimitS));
auto timelimit = cmDuration(atof(timelimitS));
auto duration = std::chrono::duration_cast<std::chrono::duration<double>>(
auto duration = std::chrono::duration_cast<cmDuration>(
std::chrono::steady_clock::now() - this->ScriptStartTime);
return (timelimit - duration);
}
......@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
#include <chrono>
#include <string>
......@@ -96,7 +97,7 @@ public:
* seconds if the user has set the variable CTEST_TIME_LIMIT. If that has
* not been set it returns a very large value.
*/
std::chrono::duration<double> GetRemainingTimeAllowed();
cmDuration GetRemainingTimeAllowed();
cmCTestScriptHandler();
~cmCTestScriptHandler() override;
......
......@@ -16,6 +16,7 @@
#include "cmCTestScriptHandler.h"
#include "cmCryptoHash.h"
#include "cmCurl.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmProcessOutput.h"
#include "cmState.h"
......@@ -497,7 +498,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
? ""
: this->GetOption("RetryCount");
auto delay = std::chrono::duration<double>(
auto delay = cmDuration(
retryDelay.empty()
? atoi(this->CTest->GetCTestConfiguration("CTestSubmitRetryDelay")
.c_str())
......
......@@ -4,6 +4,7 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
......@@ -37,12 +38,12 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
const char* ctestTimeout =
this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
std::chrono::duration<double> timeout;
cmDuration timeout;
if (ctestTimeout) {
timeout = std::chrono::duration<double>(atof(ctestTimeout));
timeout = cmDuration(atof(ctestTimeout));
} else {
timeout = this->CTest->GetTimeOut();
if (timeout <= std::chrono::duration<double>::zero()) {
if (timeout <= cmDuration::zero()) {
// By default use timeout of 10 minutes
timeout = std::chrono::minutes(10);
}
......
......@@ -21,6 +21,7 @@
#include "cmCTest.h"
#include "cmCTestMultiProcessHandler.h"
#include "cmCommand.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
......@@ -346,7 +347,7 @@ void cmCTestTestHandler::Initialize()
{
this->Superclass::Initialize();
this->ElapsedTestingTime = std::chrono::duration<double>();
this->ElapsedTestingTime = cmDuration();
this->TestResults.clear();
......@@ -539,7 +540,7 @@ int cmCTestTestHandler::ProcessHandler()
this->PrintLabelOrSubprojectSummary(false);
}
char realBuf[1024];
std::chrono::duration<double> durationInSecs = clock_finish - clock_start;
cmDuration durationInSecs = clock_finish - clock_start;
sprintf(realBuf, "%6.2f sec", durationInSecs.count());
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
"\nTotal Test time (real) = " << realBuf << "\n",
......@@ -1235,9 +1236,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
p.Cost = static_cast<float>(rand());
}
if (p.Timeout == std::chrono::duration<double>::zero() &&
this->CTest->GetGlobalTimeout() !=
std::chrono::duration<double>::zero()) {
if (p.Timeout == cmDuration::zero() &&
this->CTest->GetGlobalTimeout() != cmDuration::zero()) {
p.Timeout = this->CTest->GetGlobalTimeout();
}
......@@ -2140,7 +2140,7 @@ bool cmCTestTestHandler::SetTestsProperties(
rt.FixturesRequired.insert(lval.begin(), lval.end());
}
if (key == "TIMEOUT") {
rt.Timeout = std::chrono::duration<double>(atof(val.c_str()));
rt.Timeout = cmDuration(atof(val.c_str()));
rt.ExplicitTimeout = true;
}
if (key == "COST") {
......@@ -2220,8 +2220,7 @@ bool cmCTestTestHandler::SetTestsProperties(
"TIMEOUT_AFTER_MATCH expects two arguments, found "
<< propArgs.size() << std::endl);
} else {
rt.AlternateTimeout =
std::chrono::duration<double>(atof(propArgs[0].c_str()));
rt.AlternateTimeout = cmDuration(atof(propArgs[0].c_str()));
std::vector<std::string> lval;
cmSystemTools::ExpandListArgument(propArgs[1], lval);
for (std::string const& cr : lval) {
......@@ -2339,7 +2338,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.WillFail = false;
test.Disabled = false;
test.RunSerial = false;
test.Timeout = std::chrono::duration<double>::zero();
test.Timeout = cmDuration::zero();
test.ExplicitTimeout = false;
test.Cost = 0;
test.Processors = 1;
......
......@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
#include "cmsys/RegularExpression.hxx"
#include <chrono>
......@@ -123,9 +124,9 @@ public:
float Cost;
int PreviousRuns;
bool RunSerial;
std::chrono::duration<double> Timeout;
cmDuration Timeout;
bool ExplicitTimeout;
std::chrono::duration<double> AlternateTimeout;
cmDuration AlternateTimeout;
int Index;
// Requested number of process slots
int Processors;
......@@ -146,7 +147,7 @@ public:
std::string Path;
std::string Reason;
std::string FullCommandLine;
std::chrono::duration<double> ExecutionTime;
cmDuration ExecutionTime;
int ReturnValue;
int Status;
std::string ExceptionStatus;
......@@ -198,7 +199,7 @@ protected:
//! Clean test output to specified length
bool CleanTestOutput(std::string& output, size_t length);
std::chrono::duration<double> ElapsedTestingTime;
cmDuration ElapsedTestingTime;
typedef std::vector<cmCTestTestResult> TestResultsVector;
TestResultsVector TestResults;
......
......@@ -62,8 +62,8 @@ cmProcess::cmProcess(cmCTestRunTest& runner)
: Runner(runner)
, Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE)
{
this->Timeout = std::chrono::duration<double>::zero();
this->TotalTime = std::chrono::duration<double>::zero();
this->Timeout = cmDuration::zero();
this->TotalTime = cmDuration::zero();
this->ExitValue = 0;
this->Id = 0;
this->StartTime = std::chrono::steady_clock::time_point();
......@@ -344,8 +344,8 @@ void cmProcess::OnExit(int64_t exit_status, int term_signal)
// negative. If someone changed the system clock while the process was
// running this may be even more. Make sure not to report a negative
// duration here.
if (this->TotalTime <= std::chrono::duration<double>::zero()) {
this->TotalTime = std::chrono::duration<double>::zero();
if (this->TotalTime <= cmDuration::zero()) {
this->TotalTime = cmDuration::zero();
}
this->ProcessHandleClosed = true;
......@@ -360,7 +360,7 @@ cmProcess::State cmProcess::GetProcessStatus()
return this->ProcessState;
}
void cmProcess::ChangeTimeout(std::chrono::duration<double> t)
void cmProcess::ChangeTimeout(cmDuration t)
{
this->Timeout = t;
this->StartTimer();
......
......@@ -4,6 +4,7 @@
#define cmProcess_h
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmDuration.h"
#include "cmProcessOutput.h"
#include "cmUVHandlePtr.h"
......@@ -31,8 +32,8 @@ public:
void SetCommand(const char* command);
void SetCommandArguments(std::vector<std::string> const& arg);
void SetWorkingDirectory(const char* dir) { this->WorkingDirectory = dir; }
void SetTimeout(std::chrono::duration<double> t) { this->Timeout = t; }
void ChangeTimeout(std::chrono::duration<double> t);
void SetTimeout(cmDuration t) { this->Timeout = t; }
void ChangeTimeout(cmDuration t);
void ResetStartTime();
// Return true if the process starts
bool StartProcess(uv_loop_t& loop);
......@@ -53,7 +54,7 @@ public:
int GetId() { return this->Id; }
void SetId(int id) { this->Id = id; }
int GetExitValue() { return this->ExitValue; }
std::chrono::duration<double> GetTotalTime() { return this->TotalTime; }
cmDuration GetTotalTime() { return this->TotalTime; }
enum class Exception
{
......@@ -69,9 +70,9 @@ public:
std::string GetExitExceptionString();
private:
std::chrono::duration<double> Timeout;
cmDuration Timeout;
std::chrono::steady_clock::time_point StartTime;
std::chrono::duration<double> TotalTime;
cmDuration TotalTime;
bool ReadHandleClosed = false;
bool ProcessHandleClosed = false;
......
......@@ -277,8 +277,8 @@ cmCTest::cmCTest()
this->TestModel = cmCTest::EXPERIMENTAL;
this->MaxTestNameWidth = 30;
this->InteractiveDebugMode = true;
this->TimeOut = std::chrono::duration<double>::zero();
this->GlobalTimeout = std::chrono::duration<double>::zero();
this->TimeOut = cmDuration::zero();
this->GlobalTimeout = cmDuration::zero();
this->CompressXMLFiles = false;
this->ScheduleType.clear();
this->OutputLogFile = nullptr;
......@@ -954,8 +954,7 @@ int cmCTest::GetTestModelFromString(const char* str)
//######################################################################
int cmCTest::RunMakeCommand(const char* command, std::string& output,
int* retVal, const char* dir,
std::chrono::duration<double> timeout,
int* retVal, const char* dir, cmDuration timeout,
std::ostream& ofs, Encoding encoding)
{
// First generate the command and arguments
......@@ -1071,28 +1070,26 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
//######################################################################
int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
int* retVal, std::ostream* log,
std::chrono::duration<double> testTimeOut,
int* retVal, std::ostream* log, cmDuration testTimeOut,
std::vector<std::string>* environment, Encoding encoding)
{
bool modifyEnv = (environment && !environment->empty());
// determine how much time we have
std::chrono::duration<double> timeout = this->GetRemainingTimeAllowed();
cmDuration timeout = this->GetRemainingTimeAllowed();
if (timeout !=