Correctly handle missing logs
This commit is contained in:
parent
1943b60ad8
commit
99ed558a93
|
@ -460,7 +460,7 @@ static void opReadLog(Strings opFlags, Strings opArgs)
|
||||||
foreach (Strings::iterator, i, opArgs) {
|
foreach (Strings::iterator, i, opArgs) {
|
||||||
Path path = useDeriver(followLinksToStorePath(*i));
|
Path path = useDeriver(followLinksToStorePath(*i));
|
||||||
|
|
||||||
for (int j = 0; j < 2; j++) {
|
for (int j = 0; j <= 2; j++) {
|
||||||
if (j == 2) throw Error(format("build log of derivation `%1%' is not available") % path);
|
if (j == 2) throw Error(format("build log of derivation `%1%' is not available") % path);
|
||||||
|
|
||||||
string baseName = baseNameOf(path);
|
string baseName = baseNameOf(path);
|
||||||
|
@ -474,6 +474,7 @@ static void opReadLog(Strings opFlags, Strings opArgs)
|
||||||
/* !!! Make this run in O(1) memory. */
|
/* !!! Make this run in O(1) memory. */
|
||||||
string log = readFile(logPath);
|
string log = readFile(logPath);
|
||||||
writeFull(STDOUT_FILENO, (const unsigned char *) log.data(), log.size());
|
writeFull(STDOUT_FILENO, (const unsigned char *) log.data(), log.size());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (pathExists(logBz2Path)) {
|
else if (pathExists(logBz2Path)) {
|
||||||
|
@ -492,6 +493,7 @@ static void opReadLog(Strings opFlags, Strings opArgs)
|
||||||
writeFull(STDOUT_FILENO, buf, n);
|
writeFull(STDOUT_FILENO, buf, n);
|
||||||
} while (err != BZ_STREAM_END);
|
} while (err != BZ_STREAM_END);
|
||||||
BZ2_bzReadClose(&err, bz);
|
BZ2_bzReadClose(&err, bz);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue