about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-01T11·21+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-01T11·21+0200
commit470553bd0572c4010407acb4e410b45a521e5f11 (patch)
tree14993ee22500d880259fbff812f023ad8af001a8
parent4ddd077bfa9ad497e795a7f60d7734daf62117c1 (diff)
Don't let stderr writes in substituters cause a deadlock
-rw-r--r--src/libstore/local-store.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 687ad7e47f19..dce57f751a99 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1007,6 +1007,10 @@ void LocalStore::startSubstituter(const Path & substituter, RunningSubstituter &
     fromPipe.create();
     errorPipe.create();
 
+    /* Hack: prevent substituters that write too much to stderr from
+       deadlocking our read() from stdout. */
+    fcntl(errorPipe.writeSide, F_SETFL, O_NONBLOCK);
+
     setSubstituterEnv();
 
     run.pid = maybeVfork();