about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-08T09·27+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-08T09·27+0200
commit88e6bb76de5564b3217be9688677d1c89101b2a3 (patch)
tree161859928797dbe82a7208c4c673b81673e7cb50 /src
parent24e23a1a73d573c5d0cda86c34e0e1fd5aef9171 (diff)
Communicate the structured log FD to builders
Since we may use a dedicated file descriptor in the future, this
allows us to change it. So builders can do

  if [[ -n $NIX_LOG_FD ]]; then
    echo "@nix { message... }" >&$NIX_LOG_FD
  fi
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index ddf4bf00d8c2..3b3cebfb18f1 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2202,7 +2202,7 @@ void DerivationGoal::initEnv()
     env["NIX_BUILD_CORES"] = (format("%d") % settings.buildCores).str();
 
     /* In non-structured mode, add all bindings specified in the
-       derivation via the environments, except those listed in the
+       derivation via the environment, except those listed in the
        passAsFile attribute. Those are passed as file names pointing
        to temporary files containing the contents. Note that
        passAsFile is ignored in structure mode because it's not
@@ -2258,6 +2258,11 @@ void DerivationGoal::initEnv()
         Strings varNames = tokenizeString<Strings>(get(drv->env, "impureEnvVars"));
         for (auto & i : varNames) env[i] = getEnv(i);
     }
+
+    /* Currently structured log messages piggyback on stderr, but we
+       may change that in the future. So tell the builder which file
+       descriptor to use for that. */
+    env["NIX_LOG_FD"] = "2";
 }