nix-shell: Don't warn about the lack of a GC root

This commit is contained in:
Eelco Dolstra 2013-12-20 12:19:10 +00:00
parent 0c1198cf08
commit 769f662165
2 changed files with 6 additions and 1 deletions

View File

@ -179,7 +179,7 @@ foreach my $expr (@exprs) {
# Build or fetch all dependencies of the derivation. # Build or fetch all dependencies of the derivation.
my @inputDrvs = grep { my $x = $_; (grep { $x =~ $_ } @envExclude) == 0 } @{$drv->{inputDrvs}}; 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"; or die "$0: failed to build all dependencies\n";
# Set the environment. # Set the environment.

View File

@ -35,8 +35,11 @@ static void sigintHandler(int signo)
} }
static bool gcWarning = true;
void printGCWarning() void printGCWarning()
{ {
if (!gcWarning) return;
static bool haveWarned = false; static bool haveWarned = false;
warnOnce(haveWarned, warnOnce(haveWarned,
"you did not specify `--add-root'; " "you did not specify `--add-root'; "
@ -212,6 +215,8 @@ static void initAndRun(int argc, char * * argv)
settings.useBuildHook = false; settings.useBuildHook = false;
else if (arg == "--show-trace") else if (arg == "--show-trace")
settings.showTrace = true; settings.showTrace = true;
else if (arg == "--no-gc-warning")
gcWarning = false;
else if (arg == "--option") { else if (arg == "--option") {
++i; if (i == args.end()) throw UsageError("`--option' requires two arguments"); ++i; if (i == args.end()) throw UsageError("`--option' requires two arguments");
string name = *i; string name = *i;