Skip to content

Commit 33e49e2

Browse files
committed
fix: Fix color variables being passed.
1 parent 6021168 commit 33e49e2

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

.yarn/versions/cd7505ac.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
releases:
2+
"@moonrepo/cli": patch
3+
"@moonrepo/core-linux-arm64-gnu": patch
4+
"@moonrepo/core-linux-arm64-musl": patch
5+
"@moonrepo/core-linux-x64-gnu": patch
6+
"@moonrepo/core-linux-x64-musl": patch
7+
"@moonrepo/core-macos-arm64": patch
8+
"@moonrepo/core-macos-x64": patch
9+
"@moonrepo/core-windows-x64-msvc": patch

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
#### 🐞 Fixes
6+
7+
- Fixed an issue where `NO_COLOR` or `FORCE_COLOR` would be overwritten for task child processes.
8+
39
## 1.32.1
410

511
#### 🚀 Updates

crates/process/src/command.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,20 @@ impl Command {
138138
}
139139

140140
pub fn inherit_colors(&mut self) -> &mut Self {
141-
let level = color::supports_color().to_string();
142-
141+
// Don't show colors in our own tests, as it disrupts snapshots
143142
if !is_test_env() {
144-
self.env_remove("NO_COLOR");
145-
self.env("FORCE_COLOR", &level);
146-
self.env("CLICOLOR_FORCE", &level);
143+
let no_color = OsString::from("NO_COLOR");
144+
let force_color = OsString::from("FORCE_COLOR");
145+
146+
// Only inherit colors if the current command hasn't
147+
// explicitly configured these variables
148+
if !self.env.contains_key(&no_color) && !self.env.contains_key(&force_color) {
149+
let level = color::supports_color().to_string();
150+
151+
self.env_remove(no_color);
152+
self.env(force_color, &level);
153+
self.env("CLICOLOR_FORCE", &level);
154+
}
147155
}
148156

149157
// Force a terminal width so that we have consistent sizing

website/docs/commands/overview.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ $ MOON_CONCURRENCY=1 moon run app:build
8787
At minimum, most debugging can be done by passing [`--log trace`](#logging) on the command line and
8888
sifting through the logs. We also provide the following environment variables to toggle output.
8989

90-
- `MOON_DEBUG_PROCESS_ENV` - By default moon hides the environment variables (except for `MOON` or
91-
`PROTO`) passed to processes to avoid leaking sensitive information. However, knowing what
92-
environment variables are passed around is helpful in debugging. Declare this variable to reveal
93-
the entire environment.
90+
- `MOON_DEBUG_PROCESS_ENV` - By default moon hides the environment variables (except for `MOON_`)
91+
passed to processes to avoid leaking sensitive information. However, knowing what environment
92+
variables are passed around is helpful in debugging. Declare this variable to reveal the entire
93+
environment.
9494
- `MOON_DEBUG_PROCESS_INPUT` - By default moon truncates the stdin passed to processes to avoid
9595
thrashing the console with a large input string. However, knowing what input is passed around is
9696
helpful in debugging. Declare this variable to reveal the entire input.

0 commit comments

Comments
 (0)