about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-08-20T00·25+0100
committertazjin <mail@tazj.in>2020-08-20T11·48+0000
commit883de9b8d71b9cb984d8ff315b4dcc30e0ca9082 (patch)
tree2a8175cd758f2d8c08157a3790b08f8886e36726 /third_party/nix/src/libstore/store-api.cc
parentdfc351b4634aff4c56a08ab4f47139ccaf6dc652 (diff)
feat(tvix): Add a no-op stream buffer for discarding build logs r/1684
In some cases we don't have anywhere for the build logs to go. Until
we understand those cases fully and can get rid of them, this null
sink implementation can be used.

Change-Id: Ib93c43caf268e2c01c43d59737a829e8c43d223e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1792
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src/libstore/store-api.cc')
-rw-r--r--third_party/nix/src/libstore/store-api.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc
index fc33c7ce5711..3ada63532ca2 100644
--- a/third_party/nix/src/libstore/store-api.cc
+++ b/third_party/nix/src/libstore/store-api.cc
@@ -1,6 +1,8 @@
 #include "libstore/store-api.hh"
 
 #include <future>
+#include <ostream>
+#include <streambuf>
 #include <utility>
 
 #include <absl/status/status.h>
@@ -23,6 +25,17 @@
 
 namespace nix {
 
+namespace {
+class NullStream : public std::streambuf {
+ public:
+  int overflow(int c) override { return c; }
+};
+
+static NullStream NULL_STREAM{};
+}  // namespace
+
+std::ostream DiscardLogsSink() { return std::ostream(&NULL_STREAM); }
+
 std::optional<BuildMode> BuildModeFrom(nix::proto::BuildMode mode) {
   switch (mode) {
     case nix::proto::BuildMode::Normal: