From 99b536dda93d37a4db159424b7d34aa3d04d283e Mon Sep 17 00:00:00 2001 From: John Snow Date: Thu, 29 Aug 2019 19:52:00 -0400 Subject: [PATCH 1/2] out.py: switch .info() and .note() to use stderr In POSIX tradition, informational messages that are not essential output belong on stderr. Semantically, it appears as if both .info() and .note() are used for such messages, so switch them to that stream. --- stgit/out.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stgit/out.py b/stgit/out.py index 312dcd75..8d09ccb5 100644 --- a/stgit/out.py +++ b/stgit/out.py @@ -127,10 +127,10 @@ def err_bytes(self, byte_data): def info(self, *msgs): for msg in msgs: - self.__out.single_line(msg) + self.__stderr.single_line(msg) def note(self, *msgs, **kw): - self.__out.tagged_lines(kw.get('title', 'Notice'), msgs) + self.__stderr.tagged_lines(kw.get('title', 'Notice'), msgs) def warn(self, *msgs, **kw): self.__stderr.tagged_lines(kw.get('title', 'Warning'), msgs) From 79ac89359ee9b565c3049744000be0ade311fa3e Mon Sep 17 00:00:00 2001 From: John Snow Date: Thu, 15 Aug 2019 16:52:06 -0400 Subject: [PATCH 2/2] out.py: relax tty restriction for stdout messages Now that more messages print to stderr, we don't have to play guardian with the stdout file descriptor. --- stgit/out.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/stgit/out.py b/stgit/out.py index 8d09ccb5..531a1f12 100644 --- a/stgit/out.py +++ b/stgit/out.py @@ -99,10 +99,7 @@ def __init__(self, file=None): sys.stderr.fileno(), 'w', buffering=1, encoding='utf-8' ) ) - if file or sys.stdout.isatty(): - self.__out = self.__stdout - else: - self.__out = Output(None) + self.__out = self.__stdout def stdout(self, line): """Write a line to stdout."""