Browse code

Read stdin automatically when it's not a tty.

José Fonseca authored on 06/03/2012 18:29:07
Showing 1 changed files

  • xdot.py index f6cc15d..b4e2918 100755
... ...
@@ -1900,7 +1900,10 @@ def main():
1900 1900
     win = DotWindow()
1901 1901
     win.connect('destroy', gtk.main_quit)
1902 1902
     win.set_filter(options.filter)
1903
-    if len(args) >= 1:
1903
+    if len(args) == 0:
1904
+        if not sys.stdin.isatty():
1905
+            win.set_dotcode(sys.stdin.read())
1906
+    else:
1904 1907
         if args[0] == '-':
1905 1908
             win.set_dotcode(sys.stdin.read())
1906 1909
         else: