Skip to content

Commit

Permalink
lib: use ansi module in trivial.warn
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Apr 2, 2024
1 parent 50e5e29 commit 7253a4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/trivial.nix
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,8 @@ in {
*/
warn =
if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") ["1" "true" "yes"]
then msg: builtins.trace "[1;31mwarning: ${msg}[0m" (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.")
else msg: builtins.trace "[1;31mwarning: ${msg}[0m";
then msg: builtins.trace (lib.ansi.stylizeError msg) (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.")
else msg: builtins.trace (lib.ansi.stylizeWarn msg);

/**
Like warn, but only warn when the first argument is `true`.
Expand Down

0 comments on commit 7253a4d

Please sign in to comment.