Skip to content
Myr

fix(spin): if not a tty, only print title, do not open tty for stdin (#763)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #328

authored by Carlos Alexandro Becker · committed by GitHub · parent 2e53efc · Browse files · 2 files+14 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−3 removed

  • other:+14 added−3 removed

2 files+14 added−3 removed

modified:spin/command.go+9 added-3 removed
24 unmodified lines
25 command: o.Command,26 align: o.Align,27 showOutput: o.ShowOutput && isTTY,28 showError: o.ShowError,29 isTTY: isTTY,30 }3132 ctx, cancel := timeout.Context(o.Timeout)33 defer cancel()3434 tm, err := tea.NewProgram(35 m,35 opts := []tea.ProgramOption{36 tea.WithOutput(os.Stderr),37 tea.WithContext(ctx),38 ).Run()38 }3940 if !isTTY {41 opts = append(opts, tea.WithInput(nil))42 }4344 tm, err := tea.NewProgram(m, opts...).Run()45 if err != nil {46 return fmt.Errorf("unable to run action: %w", err)47 }48
26 unmodified lines
modified:spin/spin.go+5 added
30 unmodified lines
31 title string32 align string33 command []string34 quitting bool35 isTTY bool36 status int37 stdout string38 stderr string39 output string
61 unmodified lines
101 )102}103104func (m model) View() string {105 if !m.isTTY {106 return m.title107 }108109 if m.quitting && m.showOutput {110 return strings.TrimPrefix(errbuf.String()+"\n"+outbuf.String(), "\n")111 }112
32 unmodified lines