Skip to content

Commit

Permalink
fix: don't concurrently change output profiles
Browse files Browse the repository at this point in the history
Multiple lipgloss renderer instances can end up using the same default
termenv.Output. This leads to a race condition when manipulating the
ColorProfile concurrently.

We could mutex protect the standard output in termenv, but it feels like
a weak promise, as the rest of the Output wouldn't (and probably
shouldn't) get protected. Protecting it in lipgloss itself would require
a global lock however.

I can't come up with a proper use-case for this scenario, and therefore
we shift this responsibility to the user.
  • Loading branch information
muesli committed Feb 22, 2023
1 parent 776c15f commit a74950e
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions style_test.go
Expand Up @@ -58,8 +58,6 @@ func TestStyleRender(t *testing.T) {
}

func TestStyleCustomRender(t *testing.T) {
t.Parallel()

r := NewRenderer(WithColorProfile(termenv.TrueColor), WithDarkBackground(false))
tt := []struct {
style Style
Expand Down

0 comments on commit a74950e

Please sign in to comment.