Skip to content

Commit

Permalink
try to fix missing tty error
Browse files Browse the repository at this point in the history
  • Loading branch information
adwski committed May 15, 2024
1 parent c5dd359 commit 92cb369
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/tool/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/enescakir/emoji"
"github.com/go-resty/resty/v2"
"github.com/mattn/go-isatty"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -150,7 +151,13 @@ func (t *Tool) RunWithProgram(ctx context.Context, wg *sync.WaitGroup, errc chan
func (t *Tool) run(ctx context.Context, wg *sync.WaitGroup) error {
defer wg.Done()
t.initialize()
t.prog = tea.NewProgram(t, tea.WithContext(ctx))
var teaOpts = []tea.ProgramOption{tea.WithContext(ctx)}
if !isatty.IsTerminal(os.Stdout.Fd()) {
// workaround for missing tty when running in CI
// https://github.com/charmbracelet/bubbletea/issues/761
teaOpts = append(teaOpts, tea.WithInput(nil))
}
t.prog = tea.NewProgram(t, teaOpts...)
wg.Add(1)
go t.listenForEvents(ctx, wg)
if _, err := t.prog.Run(); err != nil {
Expand Down

0 comments on commit 92cb369

Please sign in to comment.