mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
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".
(cherry picked from commit 3cac8734ac)
This commit is contained in:
parent
0995763eb1
commit
e9c5be6fe7
1 changed files with 1 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue