nix/search: no error for empty search results if json is enabled

- result list will be always empty if --json is passed
- for scripts an empty search result is not really an error,
  we rather want to distinguish between evaluation errors and empty results
This commit is contained in:
Jörg Thalheim
2020-05-06 14:43:54 +01:00
parent a721a0b114
commit 85c1932c94
+1 -1
View File
@@ -265,7 +265,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
throw SysError("cannot rename '%s' to '%s'", tmpFile, jsonCacheFileName);
}
if (results.size() == 0)
if (!json && results.size() == 0)
throw Error("no results for the given search term(s)!");
RunPager pager;