aboutsummaryrefslogtreecommitdiff
path: root/src/nix-collect-garbage/nix-collect-garbage.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-collect-garbage/nix-collect-garbage.cc')
-rw-r--r--src/nix-collect-garbage/nix-collect-garbage.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc
index 37fe22f48..d4060ac93 100644
--- a/src/nix-collect-garbage/nix-collect-garbage.cc
+++ b/src/nix-collect-garbage/nix-collect-garbage.cc
@@ -2,6 +2,7 @@
#include "profiles.hh"
#include "shared.hh"
#include "globals.hh"
+#include "legacy.hh"
#include <iostream>
#include <cerrno>
@@ -48,12 +49,10 @@ void removeOldGenerations(std::string dir)
}
}
-int main(int argc, char * * argv)
+static int _main(int argc, char * * argv)
{
- bool removeOld = false;
-
- return handleExceptions(argv[0], [&]() {
- initNix();
+ {
+ bool removeOld = false;
GCOptions options;
@@ -90,5 +89,9 @@ int main(int argc, char * * argv)
PrintFreed freed(true, results);
store->collectGarbage(options, results);
}
- });
+
+ return 0;
+ }
}
+
+static RegisterLegacyCommand s1("nix-collect-garbage", _main);