diff --git a/commands/ci/status/status.go b/commands/ci/status/status.go index 2b36e450c6d859ea1d77090ec9cb2eb734e21a66..623df22764c8fa34fb2c475a95c0ef82229d3d8b 100644 --- a/commands/ci/status/status.go +++ b/commands/ci/status/status.go @@ -110,8 +110,8 @@ func NewCmdStatus(f *cmdutils.Factory) *cobra.Command { } fmt.Fprintf(writer.Newline(), "Pipeline State: %s\n\n", runningPipeline.Status) - // break loop if output is a TTY to avoid prompting - if !f.IO.IsOutputTTY() || !f.IO.PromptEnabled() { + // break loop if input or output is a TTY to avoid prompting + if !(f.IO.IsInputTTY() && f.IO.PromptEnabled()) { break } if (runningPipeline.Status == "pending" || runningPipeline.Status == "running") && live { diff --git a/pkg/iostreams/iostreams.go b/pkg/iostreams/iostreams.go index 8839fe10681114825667c1cb12160c31c990b414..f3448d1f510d3adcc4be17797a84297408908517 100644 --- a/pkg/iostreams/iostreams.go +++ b/pkg/iostreams/iostreams.go @@ -215,6 +215,10 @@ func (s *IOStreams) IsOutputTTY() bool { return s.IsErrTTY && s.IsaTTY } +func (s *IOStreams) IsInputTTY() bool { + return s.IsInTTY && s.IsaTTY && s.IsErrTTY +} + func (s *IOStreams) ResolveBackgroundColor(style string) string { if style == "" { style = os.Getenv("GLAMOUR_STYLE")