Browse code

Wrap quiet option in try/except

Siddarth Prakash authored on 2013/03/09 07:05:28
Showing 1 changed files
... ...
@@ -1832,8 +1832,12 @@ def main():
1832 1832
         sys.exit(0)
1833 1833
 
1834 1834
     if options.quiet:
1835
-        sys.stdout.close()
1836
-        sys.stdout = open("/dev/null", "w")
1835
+        try:
1836
+            f = open("/dev/null", "w")
1837
+            sys.stdout.close()
1838
+            sys.stdout = f
1839
+        except IOError:
1840
+            warning(u"--quiet disabled.")
1837 1841
 
1838 1842
     ## Now finally parse the config file
1839 1843
     if not options.config: