cmMakefile: invoke callback after command execution

`cmMakefile` has a hook that invokes a callback before each command
execution.  The only user of that hook is `cmCTestScriptHandler`,
which uses it to update the elapsed time since it was started.
The `ctest_sleep` command again updates the elapsed time explicitly.
This explicit update can be saved by invoking the callback after
the command execution instead.
This commit is contained in:
Daniel Pfeifer
2024-10-09 00:27:33 +02:00
parent 8bb0281896
commit 1440b05bf1
2 changed files with 4 additions and 8 deletions
-4
View File
@@ -20,8 +20,6 @@ bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args,
unsigned int time1 = atoi(args[0].c_str());
if (args.size() == 1) {
cmCTestScriptHandler::SleepInSeconds(time1);
// update the elapsed time since it could have slept for a while
this->CTestScriptHandler->UpdateElapsedTime();
return true;
}
@@ -32,8 +30,6 @@ bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args,
if (time1 + duration > time2) {
duration = (time1 + duration - time2);
cmCTestScriptHandler::SleepInSeconds(duration);
// update the elapsed time since it could have slept for a while
this->CTestScriptHandler->UpdateElapsedTime();
}
return true;
}
+4 -4
View File
@@ -486,10 +486,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
return result;
}
if (this->ExecuteCommandCallback) {
this->ExecuteCommandCallback();
}
// Place this call on the call stack.
cmMakefileCall stack_manager(this, lff, std::move(deferId), status);
static_cast<void>(stack_manager);
@@ -545,6 +541,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
}
}
if (this->ExecuteCommandCallback) {
this->ExecuteCommandCallback();
}
return result;
}