Read binary from stdin.
authorThomi Richards <thomi.richards@canonical.com>
Mon, 25 Nov 2013 05:32:29 +0000 (18:32 +1300)
committerThomi Richards <thomi.richards@canonical.com>
Mon, 25 Nov 2013 05:32:29 +0000 (18:32 +1300)
python/subunit/_output.py

index 8be2ca8..0a1ef5d 100644 (file)
@@ -131,7 +131,10 @@ def parse_arguments(args=None, ParserClass=OptionParser):
         if options.attach_file == '-':
             if not options.file_name:
                 options.file_name = 'stdin'
-            options.attach_file = sys.stdin
+            if sys.version[0] >= '3':
+                options.attach_file = sys.stdin.buffer
+            else:
+                options.attach_file = sys.stdin
         else:
             try:
                 options.attach_file = open(options.attach_file, 'rb')