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:
parent
3c6b8a5215
commit
829af22759
3 changed files with 33 additions and 4 deletions
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue