Skip to content
Snippets Groups Projects
Commit 99ed558a authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

Correctly handle missing logs

parent 1943b60a
No related branches found
No related tags found
No related merge requests found
...@@ -460,7 +460,7 @@ static void opReadLog(Strings opFlags, Strings opArgs) ...@@ -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) ...@@ -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) ...@@ -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;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment