From a322fcea4a3630853bb1e91f411da5d37a8b4523 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 12 Oct 2024 20:20:03 +0200 Subject: [PATCH] worker: respect C-c on `sudo nix-build` While debugging something else I observed that latest `main` ignores `Control-C` on `sudo nix-build`. After reading through the capnproto docs, it seems as if the promise must be fulfilled to actually terminate the `promise.wait()` below. This also applies to scenarios such as stopping the client (`nix-build`), but the builders on the daemon-side are still running, i.e. closes #540 Co-authored-by: eldritch horrors Change-Id: I9634d14df4909fc1b65d05654aad0309bcca8a0a --- src/libstore/build/worker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index d1c1abdf8..10f58f5d3 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -239,7 +239,7 @@ Worker::Results Worker::run(std::function req) auto onInterrupt = kj::newPromiseAndCrossThreadFulfiller>(); auto interruptCallback = createInterruptCallback([&] { - return result::failure(std::make_exception_ptr(makeInterrupted())); + onInterrupt.fulfiller->fulfill(result::failure(std::make_exception_ptr(makeInterrupted()))); }); auto promise = runImpl(std::move(topGoals))