hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit e54fca23cabb9a58bd8f247a4db19c9dd1ccf03a
parent 133ebe0a919aea5e188564474a7bea7ba58a2f16
Author: Autumn! <autumnull@posteo.net>
Date:   Wed, 19 Apr 2023 11:48:05 +0000

Only set HAREC_COLOR once in environ

Signed-off-by: Autumn! <autumnull@posteo.net>

Diffstat:
Mcmd/hare/plan.ha | 16+++++++++++++---
Mcmd/hare/schedule.ha | 8--------
2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/cmd/hare/plan.ha b/cmd/hare/plan.ha @@ -112,14 +112,24 @@ fn mkplan( yield target.ld_cmd; }; + let environ: [](str, str) = alloc([ + (strings::dup("HARECACHE"), strings::dup(ctx.cache)), + ]); + + if (len(os::tryenv("NO_COLOR", "")) == 0 + && os::getenv("HAREC_COLOR") is void + && tty::isatty(os::stderr_file)) { + append(environ, + (strings::dup("HAREC_COLOR"), strings::dup("1")) + ); + }; + return plan { context = ctx, target = target, workdir = os::tryenv("HARE_DEBUG_WORKDIR", temp::dir()), script = strings::dup(path::string(&buf)), - environ = alloc([ - (strings::dup("HARECACHE"), strings::dup(ctx.cache)), - ]), + environ = environ, libdir = libdir, libs = libs, progress = plan_progress { diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -17,7 +17,6 @@ use path; use shlex; use strings; use strio; -use unix::tty; fn getenv(var: str) []str = { match (os::getenv(var)) { @@ -237,13 +236,6 @@ fn sched_hare_object( module = strings::dup(ns), }); - if (len(os::tryenv("NO_COLOR", "")) == 0 - && os::getenv("HAREC_COLOR") is void - && tty::isatty(os::stderr_file)) { - append(plan.environ, - (strings::dup("HAREC_COLOR"), strings::dup("1"))); - }; - for (let i = 0z; i < len(plan.context.tags); i += 1) { if (plan.context.tags[i].mode == module::tag_mode::INCLUSIVE && plan.context.tags[i].name == "test") {