mirror of
https://github.com/NixOS/nix
synced 2024-10-18 00:16:11 -04:00
Merge 590e87e14d
into 806a91f7bf
This commit is contained in:
commit
87de5aff8e
|
@ -60,6 +60,13 @@ void PosixSourceAccessor::readFile(
|
||||||
if (fstat(fromDescriptorReadOnly(fd.get()), &st) == -1)
|
if (fstat(fromDescriptorReadOnly(fd.get()), &st) == -1)
|
||||||
throw SysError("statting file");
|
throw SysError("statting file");
|
||||||
|
|
||||||
|
if (!S_ISREG(st.st_mode)) {
|
||||||
|
std::string fileContent = nix::readFile(path.abs());
|
||||||
|
sizeCallback(fileContent.size());
|
||||||
|
sink(fileContent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sizeCallback(st.st_size);
|
sizeCallback(st.st_size);
|
||||||
|
|
||||||
off_t left = st.st_size;
|
off_t left = st.st_size;
|
||||||
|
|
|
@ -44,6 +44,7 @@ nix_tests = \
|
||||||
fetchGitSubmodules.sh \
|
fetchGitSubmodules.sh \
|
||||||
fetchGitVerification.sh \
|
fetchGitVerification.sh \
|
||||||
readfile-context.sh \
|
readfile-context.sh \
|
||||||
|
readfile-stdin.sh \
|
||||||
nix-channel.sh \
|
nix-channel.sh \
|
||||||
recursive.sh \
|
recursive.sh \
|
||||||
dependencies.sh \
|
dependencies.sh \
|
||||||
|
|
3
tests/functional/readfile-stdin.sh
Normal file
3
tests/functional/readfile-stdin.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
[[ $(echo yay | nix eval --raw --impure --expr 'builtins.readFile "/dev/stdin"') = yay ]]
|
Loading…
Reference in a new issue