From bde745cb3f8dab7a29fbc2c87eb599ff31384ab5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 28 Aug 2025 13:57:38 -0400 Subject: [PATCH] Move `killChild` call from `~DerivationBuildingGoal` to `~DerivationBuilder` Sadly we cannot unexpose `DerivationBuilder::killChild` yet, because `DerivationBuildingGoal` calls it elsewhere, but we can at least haave a better division of labor between the two destructors. --- src/libstore/build/derivation-building-goal.cc | 5 ----- src/libstore/unix/build/derivation-builder.cc | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) 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 (...) {