Skip to content

Commit

Permalink
fix: remove CI exception
Browse files Browse the repository at this point in the history
Make Termenv aware of TERMENV_TTY and assume tty using environment
variables.

Users who use the CI environment variable should export TERMENV_TTY
instead using something like `export TERMENV_TTY=$CI`

Fixes: 1111971 ("Don't run OSC queries on CI")
  • Loading branch information
aymanbagabas committed Jul 5, 2023
1 parent 51d72d3 commit b926c98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions termenv.go
Expand Up @@ -2,6 +2,7 @@ package termenv

import (
"errors"
"strconv"

"github.com/mattn/go-isatty"
)
Expand All @@ -28,9 +29,16 @@ func (o *Output) isTTY() bool {
if o.assumeTTY || o.unsafe {
return true
}

// FIXME: should check for its value instead of length
if len(o.environ.Getenv("CI")) > 0 {
return false
}

if isTty, err := strconv.ParseBool(o.environ.Getenv("TERMENV_TTY")); err == nil {
return isTty
}

if o.TTY() == nil {
return false
}
Expand Down

0 comments on commit b926c98

Please sign in to comment.