Merge pull request #9687 from edolstra/withFramedSink-ctrl-c-hang

withFramedSink(): Receive interrupts on the stderr thread

(cherry picked from commit 965cfe9688)
Change-Id: I8320a96957c01ec0e3450d1b3ae38a3baff78d49
This commit is contained in:
eldritch horrors 2024-03-04 07:40:17 +01:00
parent 137673de56
commit 8f5d0d4c05
3 changed files with 5 additions and 0 deletions

View file

@ -217,6 +217,8 @@ void PathSubstitutionGoal::tryToRun()
thr = std::thread([this]() { thr = std::thread([this]() {
try { try {
ReceiveInterrupts receiveInterrupts;
/* Wake up the worker loop when we're done. */ /* Wake up the worker loop when we're done. */
Finally updateStats([this]() { outPipe.writeSide.close(); }); Finally updateStats([this]() { outPipe.writeSide.close(); });

View file

@ -1071,6 +1071,7 @@ void RemoteStore::ConnectionHandle::withFramedSink(std::function<void(Sink & sin
std::thread stderrThread([&]() std::thread stderrThread([&]()
{ {
try { try {
ReceiveInterrupts receiveInterrupts;
processStderr(nullptr, nullptr, false); processStderr(nullptr, nullptr, false);
} catch (...) { } catch (...) {
ex = std::current_exception(); ex = std::current_exception();

View file

@ -77,6 +77,8 @@ void ThreadPool::process()
void ThreadPool::doWork(bool mainThread) void ThreadPool::doWork(bool mainThread)
{ {
ReceiveInterrupts receiveInterrupts;
if (!mainThread) if (!mainThread)
interruptCheck = [&]() { return (bool) quit; }; interruptCheck = [&]() { return (bool) quit; };