(fix): ShowOutput flag works as intended

Fixes the `--show-output` flag not piping output.
Fixes the `--show-output` flag not showing live output.
This commit is contained in:
Rose Thatcher 2023-08-01 06:07:19 -05:00 committed by GitHub
parent a63ea30136
commit d66af4f082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,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,
}
@ -46,7 +47,7 @@ func (o Options) Run() error {
}
if o.ShowOutput {
if isTTY {
if !isTTY {
_, err := os.Stdout.WriteString(m.stdout)
if err != nil {
return fmt.Errorf("failed to write to stdout: %w", err)