Hide package repository count when redirecting stdout (#29402)

This commit is contained in:
百地 希留耶 2022-03-10 02:07:07 +09:00 committed by GitHub
parent 2dd9414bbb
commit 3270aa106b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@
from __future__ import print_function
import os
import sys
import llnl.util.tty as tty
@ -142,9 +143,10 @@ def repo_list(args):
except spack.repo.RepoError:
continue
msg = "%d package repositor" % len(repos)
msg += "y." if len(repos) == 1 else "ies."
tty.msg(msg)
if sys.stdout.isatty():
msg = "%d package repositor" % len(repos)
msg += "y." if len(repos) == 1 else "ies."
tty.msg(msg)
if not repos:
return