From f1807d34ea71dc3ccd36c0973ae7bf7e5225f107 Mon Sep 17 00:00:00 2001 From: Will Hargrave Date: Wed, 1 Nov 2017 21:34:56 +0000 Subject: [PATCH] Allow '-f -' to denote stdin --- dnseval.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dnseval.py b/dnseval.py index 5306e0a..90867f2 100755 --- a/dnseval.py +++ b/dnseval.py @@ -256,8 +256,13 @@ def main(): try: if fromfile: - with open(inputfilename, 'rt') as flist: - f = flist.read().splitlines() + if inputfilename == '-': + # read from stdin + with sys.stdin as flist: + f = flist.read().splitlines() + else: + with open(inputfilename, 'rt') as flist: + f = flist.read().splitlines() else: f = resolvers if len(f) == 0: