mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
sourceToSink(): Throw EndOfFile
This commit is contained in:
parent
0194f81587
commit
609df83c01
2 changed files with 4 additions and 6 deletions
|
@ -1245,7 +1245,6 @@ StorePath LocalStore::addToStoreFromDump(
|
|||
});
|
||||
try {
|
||||
got = source.read(dumpBuffer.get() + oldSize, want);
|
||||
if (!got) break;
|
||||
} catch (EndOfFile &) {
|
||||
inMemory = true;
|
||||
break;
|
||||
|
|
|
@ -246,9 +246,8 @@ std::unique_ptr<FinishSink> sourceToSink(std::function<void(Source &)> fun)
|
|||
LambdaSource source([&](char * out, size_t out_len) {
|
||||
if (cur.empty()) {
|
||||
yield();
|
||||
if (yield.get()) {
|
||||
return (size_t) 0;
|
||||
}
|
||||
if (yield.get())
|
||||
throw EndOfFile("coroutine has finished");
|
||||
}
|
||||
|
||||
size_t n = std::min(cur.size(), out_len);
|
||||
|
@ -271,12 +270,12 @@ std::unique_ptr<FinishSink> sourceToSink(std::function<void(Source &)> fun)
|
|||
void finish() override
|
||||
{
|
||||
if (!coro) return;
|
||||
//if (!*coro) abort();
|
||||
if (!*coro) abort();
|
||||
{
|
||||
CoroutineContext ctx;
|
||||
(*coro)(true);
|
||||
}
|
||||
//if (*coro) abort();
|
||||
if (*coro) abort();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue