diff --git a/src/libstore/build/derivation-building-goal.cc b/src/libstore/build/derivation-building-goal.cc index 5af385aed..20a67008c 100644 --- a/src/libstore/build/derivation-building-goal.cc +++ b/src/libstore/build/derivation-building-goal.cc @@ -53,11 +53,6 @@ DerivationBuildingGoal::~DerivationBuildingGoal() { /* Careful: we should never ever throw an exception from a destructor. */ - try { - killChild(); - } catch (...) { - ignoreExceptionInDestructor(); - } #ifndef _WIN32 // TODO enable `DerivationBuilder` on Windows if (builder) builder.reset(); diff --git a/src/libstore/unix/build/derivation-builder.cc b/src/libstore/unix/build/derivation-builder.cc index b11eb383d..bc48d4256 100644 --- a/src/libstore/unix/build/derivation-builder.cc +++ b/src/libstore/unix/build/derivation-builder.cc @@ -94,6 +94,11 @@ public: { /* Careful: we should never ever throw an exception from a destructor. */ + try { + killChild(); + } catch (...) { + ignoreExceptionInDestructor(); + } try { stopDaemon(); } catch (...) {