Do not use stdout instead of stderr
authorCatalin Marinas <catalin.marinas@gmail.com>
Sun, 18 Oct 2009 22:04:50 +0000 (23:04 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Sun, 18 Oct 2009 22:04:50 +0000 (23:04 +0100)
The MessagePrinter constructor redirects stderr to stdout if the output
is not a file. This makes it difficult for tools needing to filter the
error output (like Documentation/Makefile building the COMMANDS
variable).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/out.py

index 753c176..aa66f3d 100644 (file)
@@ -72,13 +72,12 @@ class MessagePrinter(object):
             self.__stdout = self.__stderr = Output(file.write, file.flush)
         else:
             self.__stdout = Output(sys.stdout.write, sys.stdout.flush)
-            self.__stderr = Output(sys.stdout.write, sys.stdout.flush)
+            self.__stderr = Output(sys.stderr.write, sys.stderr.flush)
         if file or sys.stdout.isatty():
             self.__out = self.__stdout
-            self.__err = self.__stdout
         else:
             self.__out = Output(lambda msg: None, lambda: None)
-            self.__err = self.__stderr
+        self.__err = self.__stderr
     def stdout(self, line):
         """Write a line to stdout."""
         self.__stdout.write_line(line)