def run(args, output=sys.stdout, stdin=sys.stdin):
"""Observe an Ethernet interface and print ARP bindings."""
# First, become a progress group leader, so that signals can be directed
# to this process and its children; see p.u.twisted.terminateProcess.
os.setpgrp()
if args.input_file is None:
reader = _reader_from_avahi()
elif args.input_file == "-":
reader = _reader_from_stdin(stdin)
else:
reader = _reader_from_file(args.input_file)
try:
_observe_mdns(reader, output, args.verbose)
except KeyboardInterrupt:
# Suppress this exception and allow for a clean exit instead.
# ActionScript would exit 1 if we allowed it to propagate, but
# SIGINT/SIGTERM are how this script is meant to be terminated.
pass
评论列表
文章目录