[rush-lib] Remove "--color=always" option when invoking pnpm install #4389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why we needed the
color=always
option? The following screenshot shows that the error would be white instead of red without the option (this is because the custom tips feature redirected the pnpm output to aPassThrough
stream, and PNPM output would be colored only when the output is a terminal or TTY).But this
color=always
would cause another problem: in a CI environment that doesn't support colors, it would be like, "This next word should be 35m]purple34m];".Hence, in this fix, we pass along Rush's own state (
color.enabled
) to pnpm – assuming Rush could determine this state correctly. Besides, we don't use the--color=always
cli option but use theFORCE_COLOR
environment variable because we want PNPM's child process also to print colors.