mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user