aboutsummaryrefslogtreecommitdiff
path: root/nix/nix-daemon
diff options
context:
space:
mode:
Diffstat (limited to 'nix/nix-daemon')
-rw-r--r--nix/nix-daemon/nix-daemon.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 7d26b61354..deb7003d7e 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -436,7 +436,15 @@ static void performOp(bool trusted, unsigned int clientVersion,
bool sign = readInt(from) == 1;
startWork();
TunnelSink sink(to);
- store->exportPath(path, sign, sink);
+ try {
+ store->exportPath(path, sign, sink);
+ }
+ catch (Error &e) {
+ /* Flush SINK beforehand or its destructor will rightfully trigger
+ an assertion failure. */
+ sink.flush();
+ throw e;
+ }
sink.flush();
stopWork();
writeInt(1, to);