mirror of
https://github.com/charmbracelet/gum
synced 2024-05-03 23:13:14 +02:00
(fix): ShowOutput flag displays in realtime (#405)
This commit is contained in:
parent
32c9d20692
commit
5c65944c66
|
@ -24,6 +24,7 @@ func (o Options) Run() error {
|
|||
title: o.TitleStyle.ToLipgloss().Render(o.Title),
|
||||
command: o.Command,
|
||||
align: o.Align,
|
||||
showOutput: o.ShowOutput && isTTY,
|
||||
timeout: o.Timeout,
|
||||
hasTimeout: o.Timeout > 0,
|
||||
}
|
||||
|
@ -44,7 +45,9 @@ func (o Options) Run() error {
|
|||
}
|
||||
|
||||
if o.ShowOutput {
|
||||
if isTTY {
|
||||
// BubbleTea writes the View() to stderr.
|
||||
// If the program is being piped then put the accumulated output in stdout.
|
||||
if !isTTY {
|
||||
_, err := os.Stdout.WriteString(m.stdout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write to stdout: %w", err)
|
||||
|
|
Loading…
Reference in a new issue