aboutsummaryrefslogtreecommitdiff
path: root/src/nix/search.cc
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2020-05-05 12:09:46 +0100
committerJörg Thalheim <joerg@thalheim.io>2020-05-06 14:43:54 +0100
commit85c1932c9425c15d8d16da4777ed27667874a744 (patch)
tree68a118276b7fdaeaac81f4f1f5c567ccc78c8620 /src/nix/search.cc
parenta721a0b1140bf489d645f5d85737acafc1c57c65 (diff)
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
Diffstat (limited to 'src/nix/search.cc')
-rw-r--r--src/nix/search.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc
index fcad6be84..ba72c1e79 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -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;