diff options
author | Will Dietz <w@wdtz.org> | 2018-02-25T22·32-0600 |
---|---|---|
committer | Will Dietz <w@wdtz.org> | 2018-02-25T22·40-0600 |
commit | 3cac8734acb098488bd232bcee92099410d4d167 (patch) | |
tree | 811382025268a75366eac4033e405907f58388fa /src/nix/search.cc | |
parent | 8282c60d742dc6725723370249a341a944575d6c (diff) |
nix search: fix bug where we wrote to cache when shouldn't, breaking
This is exposed by the tests added previously, and resolves the error reported in #1892: "expected JSON value".
Diffstat (limited to 'src/nix/search.cc')
-rw-r--r-- | src/nix/search.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc index 87cdb2d7ed8a..1adde28cb3ca 100644 --- a/src/nix/search.cc +++ b/src/nix/search.cc @@ -237,7 +237,7 @@ struct CmdSearch : SourceExprCommand, MixJSON throw Error("error writing to %s", tmpFile); } - if (rename(tmpFile.c_str(), jsonCacheFileName.c_str()) == -1) + if (writeCache && rename(tmpFile.c_str(), jsonCacheFileName.c_str()) == -1) throw SysError("cannot rename '%s' to '%s'", tmpFile, jsonCacheFileName); } } |