From 769f66216504cd882ac7b6bdfa0dd1ff26f3efe5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 20 Dec 2013 12:19:10 +0000 Subject: [PATCH] nix-shell: Don't warn about the lack of a GC root --- scripts/nix-build.in | 2 +- src/libmain/shared.cc | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/nix-build.in b/scripts/nix-build.in index 60e8afec8..fe22058f6 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -179,7 +179,7 @@ foreach my $expr (@exprs) { # Build or fetch all dependencies of the derivation. my @inputDrvs = grep { my $x = $_; (grep { $x =~ $_ } @envExclude) == 0 } @{$drv->{inputDrvs}}; - system("$Nix::Config::binDir/nix-store", "-r", "--no-output", @buildArgs, @inputDrvs, @{$drv->{inputSrcs}}) == 0 + system("$Nix::Config::binDir/nix-store", "-r", "--no-output", "--no-gc-warning", @buildArgs, @inputDrvs, @{$drv->{inputSrcs}}) == 0 or die "$0: failed to build all dependencies\n"; # Set the environment. diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index b0b69f7f6..999b50238 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -35,8 +35,11 @@ static void sigintHandler(int signo) } +static bool gcWarning = true; + void printGCWarning() { + if (!gcWarning) return; static bool haveWarned = false; warnOnce(haveWarned, "you did not specify `--add-root'; " @@ -212,6 +215,8 @@ static void initAndRun(int argc, char * * argv) settings.useBuildHook = false; else if (arg == "--show-trace") settings.showTrace = true; + else if (arg == "--no-gc-warning") + gcWarning = false; else if (arg == "--option") { ++i; if (i == args.end()) throw UsageError("`--option' requires two arguments"); string name = *i;