From ad3097286782e9773416a929badf54777d9861a1 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Thu, 4 Apr 2024 17:27:27 +0200 Subject: 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 --- src/libstore/remote-store.cc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/libstore/remote-store.cc') 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::functionto, ex); - fun(sink); - sink.flush(); + { + FramedSink sink((*this)->to, ex); + fun(sink); + sink.flush(); + } + + stderrThread.join(); + if (ex) + std::rethrow_exception(ex); } } -- cgit v1.2.3