about summary refs log tree commit diff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-03-16T15·59+0100
committerEelco Dolstra <edolstra@gmail.com>2018-03-16T19·35+0100
commit3e6b194d78024373c2320f31f4ba0de3d0658b83 (patch)
tree76576868d1a0b728f1905e9df3ba3429f3deafe8 /src/libutil/util.hh
parent64441f055194e9fd9e924a58e67cadb030ba918f (diff)
decompress(): Use a Source and Sink
This allows decompression to happen in O(1) memory.
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 500ab7811b93..1ea1027ac0ac 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -25,6 +25,9 @@
 
 namespace nix {
 
+struct Sink;
+struct Source;
+
 
 /* Return an environment variable. */
 string getEnv(const string & key, const string & def = "");
@@ -150,6 +153,7 @@ MakeError(EndOfFile, Error)
 /* Read a file descriptor until EOF occurs. */
 string drainFD(int fd);
 
+void drainFD(int fd, Sink & sink);
 
 
 /* Automatic cleanup of resources. */
@@ -256,6 +260,8 @@ struct RunOptions
     bool searchPath = true;
     Strings args;
     std::experimental::optional<std::string> input;
+    Source * stdin = nullptr;
+    Sink * stdout = nullptr;
     bool _killStderr = false;
 
     RunOptions(const Path & program, const Strings & args)
@@ -266,6 +272,8 @@ struct RunOptions
 
 std::pair<int, std::string> runProgram(const RunOptions & options);
 
+void runProgram2(const RunOptions & options);
+
 
 class ExecError : public Error
 {