X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=bin%2Fdjbdns-logparse;h=2c88462bd2ec479753ad5030f7e6da0859c1aa4d;hb=d44e155d1ca56bb0d35d2538f1eb50d7a635af3a;hp=218801d0e263f6aaa056c4ec9fe523c0270997ca;hpb=0942cb75e6d2e73f81f48166053bf3bb1997cb91;p=djbdns-logparse.git diff --git a/bin/djbdns-logparse b/bin/djbdns-logparse index 218801d..2c88462 100755 --- a/bin/djbdns-logparse +++ b/bin/djbdns-logparse @@ -2,8 +2,10 @@ r""" Convert tinydns and dnscache logs to human-readable form """ +# Avoid clobbering the top-level exit() built-in. +import sys + from signal import signal, SIGINT -from sys import exit, stdin from argparse import ArgumentParser, FileType from djbdns.io import parse_logfile @@ -17,7 +19,7 @@ parser.add_argument("logfiles", metavar="LOGFILE", type=FileType("r"), nargs="*", - default=[stdin], + default=[sys.stdin], help="djbdns logfile to process (default: stdin)") # Warning: argparse automatically opens its file arguments here, @@ -34,7 +36,7 @@ args = parser.parse_args() # Install a SIGINT handler so thst we don't spit out a stack trace when # the user accidentally starts the program with no arguments and then # hits Ctrl-C to kill it. -signal(SIGINT, lambda s,f: exit(0)) +signal(SIGINT, lambda s,f: sys.exit(0)) for f in args.logfiles: parse_logfile(f)