Skip to content

Commit

Permalink
fix(spin): if not a tty, only print title, do not open tty for stdin
Browse files Browse the repository at this point in the history
closes #328
  • Loading branch information
caarlos0 committed Dec 11, 2024
1 parent b0c9c58 commit 2741e2e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions spin/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@ func (o Options) Run() error {
align: o.Align,
showOutput: o.ShowOutput && isTTY,
showError: o.ShowError,
isTTY: isTTY,

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

unknown field isTTY in struct literal of type model

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / lint-soft

unknown field isTTY in struct literal of type model (typecheck)

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / lint-soft

unknown field isTTY in struct literal of type model) (typecheck)

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / lint

unknown field isTTY in struct literal of type model (typecheck)

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / lint

unknown field isTTY in struct literal of type model) (typecheck)

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

unknown field isTTY in struct literal of type model

Check failure on line 29 in spin/command.go

View workflow job for this annotation

GitHub Actions / snapshot / snapshot

unknown field isTTY in struct literal of type model
}

ctx, cancel := timeout.Context(o.Timeout)
defer cancel()

tm, err := tea.NewProgram(
m,
opts := []tea.ProgramOption{
tea.WithOutput(os.Stderr),
tea.WithContext(ctx),
).Run()
}

if !isTTY {
opts = append(opts, tea.WithInput(nil))
}

tm, err := tea.NewProgram(m, opts...).Run()
if err != nil {
return fmt.Errorf("unable to run action: %w", err)
}
Expand Down

0 comments on commit 2741e2e

Please sign in to comment.