forked from lix-project/lix
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".
This commit is contained in:
parent
8282c60d74
commit
3cac8734ac
1 changed files with 1 additions and 1 deletions
|
@ -237,7 +237,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
|
||||||
throw Error("error writing to %s", tmpFile);
|
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);
|
throw SysError("cannot rename '%s' to '%s'", tmpFile, jsonCacheFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue