make gcRootsDir local

just to avoid unecessary globals
This commit is contained in:
Jörg Thalheim 2021-03-21 18:37:15 +01:00
parent 2d58d8a513
commit b48e9667dc
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4

View file

@ -25,11 +25,11 @@
using namespace nix;
static Path gcRootsDir;
struct MyArgs : MixEvalArgs, MixCommonArgs
{
Path releaseExpr;
Path gcRootsDir;
bool flake = false;
bool dryRun = false;
size_t nrWorkers = 1;
@ -123,7 +123,8 @@ static void worker(
EvalState & state,
Bindings & autoArgs,
AutoCloseFD & to,
AutoCloseFD & from)
AutoCloseFD & from,
const Path &gcRootsDir)
{
Value vTop;
@ -315,7 +316,7 @@ int main(int argc, char * * argv)
if (myArgs.releaseExpr == "") throw UsageError("no expression specified");
if (gcRootsDir == "") printMsg(lvlError, "warning: `--gc-roots-dir' not specified");
if (myArgs.gcRootsDir == "") printMsg(lvlError, "warning: `--gc-roots-dir' not specified");
struct State
{
@ -352,7 +353,7 @@ int main(int argc, char * * argv)
try {
EvalState state(myArgs.searchPath, openStore());
Bindings & autoArgs = *myArgs.getAutoArgs(state);
worker(state, autoArgs, *to, *from);
worker(state, autoArgs, *to, *from, myArgs.gcRootsDir);
} catch (Error & e) {
nlohmann::json err;
auto msg = e.msg();