diff options
author | eldritch horrors <pennae@lix.systems> | 2024-04-04 17:27:27 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-04-05 20:13:02 +0000 |
commit | ad3097286782e9773416a929badf54777d9861a1 (patch) | |
tree | 86aaf89887aa23a57a8378664d5c8417244f27a8 /src/libstore/remote-store.cc | |
parent | c77b6e1fdd2ecacaa044b84dc89e89565337ddaa (diff) |
Revert "libstore: using throwing finally in withFramedSink"
This reverts commit 491caad6f62c21ffbcdebe662e63ec0f72e6f3a2.
this is not actually legal for nix! throwing exceptions in destructors
is fine, but the way nix is set up we'll end up throwing the exception
we received from the remote *twice* in some cases, and such cases will
cause an immediate terminate without active exception.
Change-Id: I74c46b9f26fd791086e4193ec60eb1deb9a5bb2a
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r-- | src/libstore/remote-store.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 2373bbdc7..3188d9330 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -1067,15 +1067,27 @@ void RemoteStore::ConnectionHandle::withFramedSink(std::function<void(Sink & sin Finally joinStderrThread([&]() { - stderrThread.join(); - if (ex) { - std::rethrow_exception(ex); + if (stderrThread.joinable()) { + stderrThread.join(); + if (ex) { + try { + std::rethrow_exception(ex); + } catch (...) { + ignoreException(); + } + } } }); - FramedSink sink((*this)->to, ex); - fun(sink); - sink.flush(); + { + FramedSink sink((*this)->to, ex); + fun(sink); + sink.flush(); + } + + stderrThread.join(); + if (ex) + std::rethrow_exception(ex); } } |