mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 07:16:17 +02:00
Merge pull request #9687 from edolstra/withFramedSink-ctrl-c-hang
withFramedSink(): Receive interrupts on the stderr thread
This commit is contained in:
commit
965cfe9688
3 changed files with 8 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include "substitution-goal.hh"
|
#include "substitution-goal.hh"
|
||||||
#include "nar-info.hh"
|
#include "nar-info.hh"
|
||||||
#include "finally.hh"
|
#include "finally.hh"
|
||||||
|
#include "signals.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -217,6 +218,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(); });
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "logging.hh"
|
#include "logging.hh"
|
||||||
#include "callback.hh"
|
#include "callback.hh"
|
||||||
#include "filetransfer.hh"
|
#include "filetransfer.hh"
|
||||||
|
#include "signals.hh"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
@ -1066,6 +1068,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();
|
||||||
|
|
|
@ -79,6 +79,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; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue