1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Print a warning when loading a large path into memory

I.e. if you have a derivation with

  src = ./huge-directory;

you'll get a warning that this is not a good idea.
This commit is contained in:
Eelco Dolstra 2014-06-10 13:30:09 +02:00
parent 3c6b8a5215
commit 829af22759
3 changed files with 33 additions and 4 deletions

View file

@ -72,6 +72,8 @@ struct BufferedSource : Source
struct FdSink : BufferedSink
{
int fd;
bool warn;
size_t written;
FdSink() : fd(-1) { }
FdSink(int fd) : fd(fd) { }
@ -95,10 +97,7 @@ struct FdSource : BufferedSource
struct StringSink : Sink
{
string s;
void operator () (const unsigned char * data, size_t len)
{
s.append((const char *) data, len);
}
void operator () (const unsigned char * data, size_t len);
};