mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
decompress(): Use a Source and Sink
This allows decompression to happen in O(1) memory.
This commit is contained in:
parent
64441f0551
commit
3e6b194d78
6 changed files with 210 additions and 91 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue