Navigation Menu

Skip to content

Commit

Permalink
Communicate the structured log FD to builders
Browse files Browse the repository at this point in the history
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
  • Loading branch information
edolstra committed Sep 8, 2017
1 parent 24e23a1 commit 88e6bb7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libstore/build.cc
Expand Up @@ -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
Expand Down Expand Up @@ -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";
}


Expand Down

1 comment on commit 88e6bb7

@copumpkin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Please sign in to comment.