From 8aa11323bb3b50e0cafba21511fd8d91158cffb3 Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Thu, 23 Jan 2025 04:14:49 +0000 Subject: [PATCH] stdenv: add note in nix logging functions about not cluttering nix-shell --- pkgs/stdenv/generic/setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 3b99861009f6..4198f41aadde 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -60,6 +60,7 @@ getAllOutputNames() { # the hook name if the caller was an implicit hook), then directed to $NIX_LOG_FD, if it's set. nixLog() { # Return a value explicitly instead of the implicit return of the last command (result of the test). + # NOTE: By requiring NIX_LOG_FD be set, we avoid dumping logging inside of nix-shell. [[ -z ${NIX_LOG_FD-} ]] && return 0 # Use the function name of the caller, unless it is _callImplicitHook, in which case use the name of the hook. @@ -74,6 +75,7 @@ nixLog() { # NOTE: This function is only every meant to be called from the nix*Log family of functions. _nixLogWithLevel() { # Return a value explicitly instead of the implicit return of the last command (result of the test). + # NOTE: By requiring NIX_LOG_FD be set, we avoid dumping logging inside of nix-shell. [[ -z ${NIX_LOG_FD-} || ${NIX_DEBUG:-0} -lt ${1:?} ]] && return 0 local logLevel