diff options
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/dump-path.cc | 1 | ||||
-rw-r--r-- | src/nix/run.cc | 4 | ||||
-rw-r--r-- | src/nix/search.cc | 12 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/nix/dump-path.cc b/src/nix/dump-path.cc index 1a1866437b07..f411c0cb7c89 100644 --- a/src/nix/dump-path.cc +++ b/src/nix/dump-path.cc @@ -29,6 +29,7 @@ struct CmdDumpPath : StorePathCommand { FdSink sink(STDOUT_FILENO); store->narFromPath(storePath, sink); + sink.flush(); } }; diff --git a/src/nix/run.cc b/src/nix/run.cc index 822654daf488..d04e106e037b 100644 --- a/src/nix/run.cc +++ b/src/nix/run.cc @@ -16,8 +16,6 @@ using namespace nix; std::string chrootHelperName = "__run_in_chroot"; -extern char * * environ; - struct CmdRun : InstallablesCommand { std::vector<std::string> command = { "bash" }; @@ -109,7 +107,7 @@ struct CmdRun : InstallablesCommand if (s) kept[var] = s; } - environ = nullptr; + clearEnv(); for (auto & var : kept) setenv(var.first.c_str(), var.second.c_str(), 1); diff --git a/src/nix/search.cc b/src/nix/search.cc index 009dfae9cf40..5ccf1b7cf529 100644 --- a/src/nix/search.cc +++ b/src/nix/search.cc @@ -87,8 +87,6 @@ struct CmdSearch : SourceExprCommand, MixJSON auto state = getEvalState(); - bool first = true; - auto jsonOut = json ? std::make_unique<JSONObject>(std::cout) : nullptr; auto sToplevel = state->symbols.create("_toplevel"); @@ -96,6 +94,8 @@ struct CmdSearch : SourceExprCommand, MixJSON bool fromCache = false; + std::map<std::string, std::string> results; + std::function<void(Value *, std::string, bool, JSONObject *)> doExpr; doExpr = [&](Value * v, std::string attrPath, bool toplevel, JSONObject * cache) { @@ -143,10 +143,7 @@ struct CmdSearch : SourceExprCommand, MixJSON jsonElem.attr("description", description); } else { - if (!first) std::cout << "\n"; - first = false; - - std::cout << fmt( + results[attrPath] = fmt( "Attribute name: %s\n" "Package name: %s\n" "Version: %s\n" @@ -245,6 +242,9 @@ struct CmdSearch : SourceExprCommand, MixJSON if (writeCache && rename(tmpFile.c_str(), jsonCacheFileName.c_str()) == -1) throw SysError("cannot rename '%s' to '%s'", tmpFile, jsonCacheFileName); } + + for (auto el : results) std::cout << el.second << "\n"; + } }; |