about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-20T12·10+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-20T12·10+0100
commit65a64522403f353880a501b02aca10fb96ea1c26 (patch)
tree2cf1368446a4ba460d1320d009a9d9c59dd9fa3a
parent7b0d8fb23d9c71f1efb119c1f267124349c82742 (diff)
nix-shell: Handle --option correctly
Fixes #181.
-rwxr-xr-xscripts/nix-build.in2
-rw-r--r--src/nix-store/nix-store.cc8
2 files changed, 7 insertions, 3 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index aaab0ce4db8b..b3f12b7062ed 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -177,7 +177,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 @buildArgs @inputDrvs @{$drv->{inputSrcs}} > /dev/null") == 0
+        system("$Nix::Config::binDir/nix-store", "-r", "--no-output", @buildArgs, @inputDrvs, @{$drv->{inputSrcs}}) == 0
             or die "$0: failed to build all dependencies\n";
 
         # Set the environment.
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 5bd8558361df..017c2c6df76d 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -35,6 +35,7 @@ void printHelp()
 static Path gcRoot;
 static int rootNr = 0;
 static bool indirectRoot = false;
+static bool noOutput = true;
 
 
 LocalStore & ensureLocalStore()
@@ -139,8 +140,9 @@ static void opRealise(Strings opFlags, Strings opArgs)
     if (!ignoreUnknown)
         foreach (Paths::iterator, i, paths) {
             PathSet paths = realisePath(*i, false);
-            foreach (PathSet::iterator, j, paths)
-                cout << format("%1%\n") % *j;
+            if (!noOutput)
+                foreach (PathSet::iterator, j, paths)
+                    cout << format("%1%\n") % *j;
         }
 }
 
@@ -900,6 +902,8 @@ void run(Strings args)
         }
         else if (arg == "--indirect")
             indirectRoot = true;
+        else if (arg == "--no-output")
+            noOutput = true;
         else if (arg[0] == '-') {
             opFlags.push_back(arg);
             if (arg == "--max-freed" || arg == "--max-links" || arg == "--max-atime") { /* !!! hack */