1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

nix-collect-garbage: Do not pass an empty argument. Closes #530

This commit is contained in:
Luca Bruno 2015-05-06 15:16:35 +00:00
parent 6519f06f39
commit 8972f7c14a

View file

@ -45,7 +45,11 @@ void removeOldGenerations(std::string dir)
if (link.find("link") != string::npos) { if (link.find("link") != string::npos) {
printMsg(lvlInfo, format("removing old generations of profile %1%") % path); printMsg(lvlInfo, format("removing old generations of profile %1%") % path);
runProgramSimple(settings.nixBinDir + "/nix-env", Strings{"-p", path, "--delete-generations", gen, dryRun ? "--dry-run" : ""}); auto args = Strings{"-p", path, "--delete-generations", gen};
if (dryRun) {
args.push_back("--dry-run");
}
runProgramSimple(settings.nixBinDir + "/nix-env", args);
} }
} else if (type == DT_DIR) { } else if (type == DT_DIR) {
removeOldGenerations(path); removeOldGenerations(path);