From 76a5432a7d1580f1f5b34959dc4f0f3b1f73d155 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Wed, 24 Jan 2024 09:49:25 +0100 Subject: [PATCH] Don't show meter in terminals that are not interactive --- osc/meter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osc/meter.py b/osc/meter.py index 8ea13b6d34..b9d1b7669a 100644 --- a/osc/meter.py +++ b/osc/meter.py @@ -5,6 +5,7 @@ import signal +import sys from abc import ABC from abc import abstractmethod from typing import Optional @@ -77,7 +78,7 @@ def create_text_meter(*args, **kwargs) -> TextMeterBase: kwargs.pop("use_pb_fallback", True) meter_class = PBTextMeter - if not have_pb_module or config.quiet or not config.show_download_progress: + if not have_pb_module or config.quiet or not config.show_download_progress or not sys.stdout.isatty(): meter_class = NoPBTextMeter return meter_class(*args, **kwargs)