From: Michael Orlitzky Date: Thu, 22 Sep 2022 02:18:18 +0000 (-0400) Subject: djbdns/io.py: handle nonexistent Popen stdin/stdout. X-Git-Tag: 0.0.1~5 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=3a5a400178399afcbc3051df860231f3c4cf4ff7;p=djbdns-logparse.git djbdns/io.py: handle nonexistent Popen stdin/stdout. Type annotations say that this is possible, so... just quit if it happens? --- diff --git a/djbdns/io.py b/djbdns/io.py index 75422c0..1e41470 100644 --- a/djbdns/io.py +++ b/djbdns/io.py @@ -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()