]> git.phdru.name Git - mimedecode.git/commitdiff
Fix a bug: option -o without any parameters
authorOleg Broytman <phd@phdru.name>
Sun, 2 Feb 2014 13:07:35 +0000 (17:07 +0400)
committerOleg Broytman <phd@phdru.name>
Sun, 2 Feb 2014 13:07:35 +0000 (17:07 +0400)
mimedecode.py

index 9aab1b3e93c499fd9df152484b8481d0dd411f0e..b6f139b6974ba2cb141d9c6999085cfdce22a02a 100755 (executable)
@@ -350,9 +350,12 @@ if __name__ == "__main__":
     la = len(arguments)
     if la == 0:
         gopts.input_filename = '-'
-        gopts.output_filename = '-'
         infile = sys.stdin
-        outfile = sys.stdout
+        if gopts.output_filename:
+            outfile = open(gopts.output_filename, 'w')
+        else:
+            gopts.output_filename = '-'
+            outfile = sys.stdout
     elif la in (1, 2):
         if (arguments[0] == '-'):
             gopts.input_filename = '-'