Inline DerivationBuildingGoal::killChild

This commit is contained in:
John Ericson
2025-12-14 00:29:15 -05:00
parent 469212bd38
commit 5be07abf6d
2 changed files with 10 additions and 19 deletions

View File

@@ -60,17 +60,6 @@ std::string DerivationBuildingGoal::key()
return "dd$" + std::string(drvPath.name()) + "$" + worker.store.printStorePath(drvPath);
}
void DerivationBuildingGoal::killChild()
{
#ifndef _WIN32 // TODO enable build hook on Windows
hook.reset();
#endif
#ifndef _WIN32 // TODO enable `DerivationBuilder` on Windows
if (builder && builder->killChild())
worker.childTerminated(this);
#endif
}
std::string showKnownOutputs(const StoreDirConfig & store, const Derivation & drv)
{
std::string msg;
@@ -490,7 +479,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
flushLine();
break;
} else if (auto * timeout = std::get_if<TimedOut>(&event)) {
killChild();
hook.reset();
co_return doneFailure(std::move(*timeout));
}
}
@@ -721,7 +710,8 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
flushLine();
break;
} else if (auto * timeout = std::get_if<TimedOut>(&event)) {
killChild();
if (builder && builder->killChild())
worker.childTerminated(this);
co_return doneFailure(std::move(*timeout));
}
}
@@ -1064,7 +1054,13 @@ Goal::Co DerivationBuildingGoal::processChildOutput(Descriptor fd, std::string_v
if (isWrittenToLog) {
logSize += data.size();
if (settings.maxLogSize && logSize > settings.maxLogSize) {
killChild();
#ifndef _WIN32 // TODO enable build hook on Windows
hook.reset();
#endif
#ifndef _WIN32 // TODO enable `DerivationBuilder` on Windows
if (builder && builder->killChild())
worker.childTerminated(this);
#endif
co_return doneFailure(BuildError(
BuildResult::Failure::LogLimitExceeded,
"%s killed after writing more than %d bytes of log output",

View File

@@ -146,11 +146,6 @@ private:
*/
std::pair<bool, SingleDrvOutputs> checkPathValidity(std::map<std::string, InitialOutput> & initialOutputs);
/**
* Forcibly kill the child process, if any.
*/
void killChild();
Done doneSuccess(BuildResult::Success::Status status, SingleDrvOutputs builtOutputs);
Done doneFailure(BuildError ex);