Skip to content

Commit

Permalink
Merge pull request NixOS#9687 from edolstra/withFramedSink-ctrl-c-hang
Browse files Browse the repository at this point in the history
withFramedSink(): Receive interrupts on the stderr thread

(cherry picked from commit 965cfe9)
Change-Id: I8320a96957c01ec0e3450d1b3ae38a3baff78d49
  • Loading branch information
eldritch horrors committed Mar 4, 2024
1 parent 137673d commit 8f5d0d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libstore/build/substitution-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ void PathSubstitutionGoal::tryToRun()

thr = std::thread([this]() {
try {
ReceiveInterrupts receiveInterrupts;

/* Wake up the worker loop when we're done. */
Finally updateStats([this]() { outPipe.writeSide.close(); });

Expand Down
1 change: 1 addition & 0 deletions src/libstore/remote-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ void RemoteStore::ConnectionHandle::withFramedSink(std::function<void(Sink & sin
std::thread stderrThread([&]()
{
try {
ReceiveInterrupts receiveInterrupts;
processStderr(nullptr, nullptr, false);
} catch (...) {
ex = std::current_exception();
Expand Down
2 changes: 2 additions & 0 deletions src/libutil/thread-pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ void ThreadPool::process()

void ThreadPool::doWork(bool mainThread)
{
ReceiveInterrupts receiveInterrupts;

if (!mainThread)
interruptCheck = [&]() { return (bool) quit; };

Expand Down

0 comments on commit 8f5d0d4

Please sign in to comment.