From c8a2546a84efb7640622adc0333a0ddc05b09ad0 Mon Sep 17 00:00:00 2001 From: Neil Roza Date: Mon, 21 Aug 2023 15:21:41 +0000 Subject: [PATCH] squash fix-7235 --- commands/ci/status/status.go | 4 ++-- pkg/iostreams/iostreams.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/ci/status/status.go b/commands/ci/status/status.go index 2b36e450c..623df2276 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 8839fe106..f3448d1f5 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") -- GitLab