]> gitweb.michael.orlitzky.com - djbdns-logparse.git/commitdiff
djbdns/io.py: handle nonexistent Popen stdin/stdout.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 22 Sep 2022 02:18:18 +0000 (22:18 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 22 Sep 2022 02:18:18 +0000 (22:18 -0400)
Type annotations say that this is possible, so... just quit if it
happens?

djbdns/io.py

index 75422c01387032f0a0aab6e87e8f40fac411d010..1e41470452a30e4c56438ff2ab1ea84a210b0566 100644 (file)
@@ -37,6 +37,9 @@ def parse_logfile(file : TextIO):
                text=True,
                bufsize=0) as tai:
 
+        if not tai.stdin or not tai.stdout:
+            return
+
         for line in file:
             tai.stdin.write(line)
             line = tai.stdout.readline()