aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/file-system.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-05-11 00:22:21 +0200
committereldritch horrors <pennae@lix.systems>2024-07-11 11:39:18 +0000
commit5587dbdcf078586dcc5b9c54af614c1915e9da0a (patch)
tree52c1de6713edddd1579f9d4740afd7e7a4cd4abe /src/libutil/file-system.cc
parentdf8851f286a407c46ea9107ca403888291f1afbe (diff)
libstore: make BinaryCacheStore::getFile return a source
this lets us remove the last true remaining uses of makeDecompressionSink. Change-Id: I146ca2bbe1a9ae9a367117a7b8a304b23a63e5e2
Diffstat (limited to 'src/libutil/file-system.cc')
-rw-r--r--src/libutil/file-system.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc
index 13c2b27eb..278e5187c 100644
--- a/src/libutil/file-system.cc
+++ b/src/libutil/file-system.cc
@@ -294,7 +294,9 @@ Generator<Bytes> readFileSource(const Path & path)
AutoCloseFD fd{open(path.c_str(), O_RDONLY | O_CLOEXEC)};
if (!fd)
throw SysError("opening file '%s'", path);
- co_yield drainFDSource(fd.get());
+ return [](AutoCloseFD fd) -> Generator<Bytes> {
+ co_yield drainFDSource(fd.get());
+ }(std::move(fd));
}