Skip to content

Commit 1111971

Browse files
committed
Don't run OSC queries on CI
1 parent 89347d6 commit 1111971

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

termenv.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ const (
2222
TrueColor
2323
)
2424

25+
func isTTY(fd uintptr) bool {
26+
if len(os.Getenv("CI")) > 0 {
27+
return false
28+
}
29+
30+
return isatty.IsTerminal(fd)
31+
}
32+
2533
// ColorProfile returns the supported color profile:
2634
// Ascii, ANSI, ANSI256, or TrueColor.
2735
func ColorProfile() Profile {
28-
if !isatty.IsTerminal(os.Stdout.Fd()) {
36+
if !isTTY(os.Stdout.Fd()) {
2937
return Ascii
3038
}
3139

@@ -34,7 +42,7 @@ func ColorProfile() Profile {
3442

3543
// ForegroundColor returns the terminal's default foreground color.
3644
func ForegroundColor() Color {
37-
if !isatty.IsTerminal(os.Stdout.Fd()) {
45+
if !isTTY(os.Stdout.Fd()) {
3846
return NoColor{}
3947
}
4048

@@ -43,7 +51,7 @@ func ForegroundColor() Color {
4351

4452
// BackgroundColor returns the terminal's default background color.
4553
func BackgroundColor() Color {
46-
if !isatty.IsTerminal(os.Stdout.Fd()) {
54+
if !isTTY(os.Stdout.Fd()) {
4755
return NoColor{}
4856
}
4957

0 commit comments

Comments
 (0)