about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLuca Bruno <lucabru@src.gnome.org>2015-05-06T15·16+0000
committerLuca Bruno <lucabru@src.gnome.org>2015-05-06T15·17+0000
commit8972f7c14a196041f8faef2f2c3f7bd705ab4e07 (patch)
treee3f10e67c8910a8ca36315b116179283ba121556 /src
parent6519f06f397448c3f1677e87e385012e2507164b (diff)
nix-collect-garbage: Do not pass an empty argument. Closes #530
Diffstat (limited to 'src')
-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 366a378a1138..ae75fd62103c 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);