Skip to content

Commit 88e6bb7

Browse files
committed
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
1 parent 24e23a1 commit 88e6bb7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libstore/build.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2202,7 +2202,7 @@ void DerivationGoal::initEnv()
22022202
env["NIX_BUILD_CORES"] = (format("%d") % settings.buildCores).str();
22032203

22042204
/* In non-structured mode, add all bindings specified in the
2205-
derivation via the environments, except those listed in the
2205+
derivation via the environment, except those listed in the
22062206
passAsFile attribute. Those are passed as file names pointing
22072207
to temporary files containing the contents. Note that
22082208
passAsFile is ignored in structure mode because it's not
@@ -2258,6 +2258,11 @@ void DerivationGoal::initEnv()
22582258
Strings varNames = tokenizeString<Strings>(get(drv->env, "impureEnvVars"));
22592259
for (auto & i : varNames) env[i] = getEnv(i);
22602260
}
2261+
2262+
/* Currently structured log messages piggyback on stderr, but we
2263+
may change that in the future. So tell the builder which file
2264+
descriptor to use for that. */
2265+
env["NIX_LOG_FD"] = "2";
22612266
}
22622267

22632268

0 commit comments

Comments
 (0)