diff --git a/lix/libutil/signals.hh b/lix/libutil/signals.hh index 919a8eb55..3abdd05fe 100644 --- a/lix/libutil/signals.hh +++ b/lix/libutil/signals.hh @@ -124,11 +124,14 @@ template kj::Promise> makeInterruptible(kj::Promise> p) { auto onInterrupt = kj::newPromiseAndCrossThreadFulfiller>(); - auto interruptCallback = createInterruptCallback([fulfiller{onInterrupt.fulfiller.get()}] { - fulfiller->fulfill(result::failure(std::make_exception_ptr(makeInterrupted()))); + // the fulfiller must be a shared_ptr> since functions must + // be copyable, and we don't have move_only_function on all stdlibs. + auto fulfiller = + std::make_shared(std::move(onInterrupt.fulfiller)); + auto interruptCallback = createInterruptCallback([fulfiller] { + (*fulfiller)->fulfill(result::failure(std::make_exception_ptr(makeInterrupted()))); }); - return p.attach(std::move(onInterrupt.fulfiller), std::move(interruptCallback)) - .exclusiveJoin(std::move(onInterrupt.promise)); + return p.attach(std::move(interruptCallback)).exclusiveJoin(std::move(onInterrupt.promise)); } void triggerInterrupt();