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 <pennae@lix.systems>

Change-Id: I9634d14df4909fc1b65d05654aad0309bcca8a0a
This commit is contained in:
Maximilian Bosch 2024-10-12 20:20:03 +02:00
parent 9865ebaaa6
commit a322fcea4a
Signed by: ma27
SSH key fingerprint: SHA256:d7dmwHmpai66L6KIXA+wxzVbkPq0nGLrcHK3ZNroqZY

View file

@ -239,7 +239,7 @@ Worker::Results Worker::run(std::function<Targets (GoalFactory &)> req)
auto onInterrupt = kj::newPromiseAndCrossThreadFulfiller<Result<Results>>();
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))