aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Bruno <lucabru@src.gnome.org>2015-05-06 15:16:35 +0000
committerLuca Bruno <lucabru@src.gnome.org>2015-05-06 15:17:23 +0000
commit8972f7c14a196041f8faef2f2c3f7bd705ab4e07 (patch)
treee3f10e67c8910a8ca36315b116179283ba121556
parent6519f06f397448c3f1677e87e385012e2507164b (diff)
nix-collect-garbage: Do not pass an empty argument. Closes #530
-rw-r--r--src/nix-collect-garbage/nix-collect-garbage.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc
index 366a378a1..ae75fd621 100644
--- a/src/nix-collect-garbage/nix-collect-garbage.cc
+++ b/src/nix-collect-garbage/nix-collect-garbage.cc
@@ -45,7 +45,11 @@ void removeOldGenerations(std::string dir)
if (link.find("link") != string::npos) {
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) {
removeOldGenerations(path);