1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

Write a destructor for DerivationBuilderImpl

This allows `DerivationBuildingGoal` to know less.
This commit is contained in:
John Ericson 2025-08-28 12:40:55 -04:00
parent 557bbe969e
commit 49da508f46
3 changed files with 33 additions and 31 deletions

View file

@ -85,6 +85,22 @@ public:
{
}
~DerivationBuilderImpl()
{
/* Careful: we should never ever throw an exception from a
destructor. */
try {
stopDaemon();
} catch (...) {
ignoreExceptionInDestructor();
}
try {
cleanupBuild(false);
} catch (...) {
ignoreExceptionInDestructor();
}
}
protected:
/**
@ -285,9 +301,11 @@ private:
*/
void startDaemon();
public:
void stopDaemon() override;
/**
* Stop the in-process nix daemon thread.
* @see startDaemon
*/
void stopDaemon();
protected:
@ -342,9 +360,17 @@ private:
*/
SingleDrvOutputs registerOutputs();
public:
protected:
void cleanupBuild(bool force) override;
/**
* Delete the temporary directory, if we have one.
*
* @param force We know the build suceeded, so don't attempt to
* preseve anything for debugging.
*/
virtual void cleanupBuild(bool force);
public:
void killSandbox(bool getStats) override;