builtins.readFile: Put the references of the file, not those needed to realize the file, into the context
This commit is contained in:
parent
7adb986e35
commit
451c223dee
1 changed files with 3 additions and 0 deletions
|
@ -779,6 +779,9 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va
|
|||
string s = readFile(state.checkSourcePath(path));
|
||||
if (s.find((char) 0) != string::npos)
|
||||
throw Error(format("the contents of the file ‘%1%’ cannot be represented as a Nix string") % path);
|
||||
context = state.store->isInStore(path) ?
|
||||
state.store->queryPathInfo(state.store->toStorePath(path))->references :
|
||||
PathSet{};
|
||||
mkString(v, s.c_str(), context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue