diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-01-22 22:07:25 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-01-22 22:07:25 +0100 |
commit | 99ed558a93216288e50b11132f2a00a74cc6bb7f (patch) | |
tree | f01c32e5640fc699fd4365495484d6650a84ba49 | |
parent | 1943b60ad820730a74d1dffcdddac396d0c1cb00 (diff) |
Correctly handle missing logs
-rw-r--r-- | src/nix-store/nix-store.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 3e1946e8d..8d26fc784 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -460,7 +460,7 @@ static void opReadLog(Strings opFlags, Strings opArgs) foreach (Strings::iterator, i, opArgs) { 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); string baseName = baseNameOf(path); @@ -474,6 +474,7 @@ static void opReadLog(Strings opFlags, Strings opArgs) /* !!! Make this run in O(1) memory. */ string log = readFile(logPath); writeFull(STDOUT_FILENO, (const unsigned char *) log.data(), log.size()); + break; } else if (pathExists(logBz2Path)) { @@ -492,6 +493,7 @@ static void opReadLog(Strings opFlags, Strings opArgs) writeFull(STDOUT_FILENO, buf, n); } while (err != BZ_STREAM_END); BZ2_bzReadClose(&err, bz); + break; } } } |