about summary refs log tree commit diff
path: root/third_party/nix/src
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
index b6a5fe358a96..eab10e9572aa 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -99,6 +99,7 @@ class BuildLogStreambuf final : public std::streambuf {
   using Writer = grpc::ServerWriter<nix::proto::BuildEvent>;
   explicit BuildLogStreambuf(Writer* writer) : writer_(writer) {}
 
+  // TODO(grfn): buffer with a timeout so we don't have too many messages
   std::streamsize xsputn(const char_type* s, std::streamsize n) override {
     nix::proto::BuildEvent event;
     event.mutable_build_log()->set_line(s, n);
@@ -106,6 +107,15 @@ class BuildLogStreambuf final : public std::streambuf {
     return n;
   }
 
+  int_type overflow(int_type ch) override {
+    if (ch != traits_type::eof()) {
+      nix::proto::BuildEvent event;
+      event.mutable_build_log()->set_line(std::string(1, ch));
+      writer_->Write(event);
+    }
+    return ch;
+  }
+
  private:
   Writer* writer_{};
 };