configd_ctl.py: catch broken pipe on event handler (#5235)

This commit is contained in:
kulikov-a 2021-09-24 22:51:56 +03:00 committed by GitHub
parent eb85feceb8
commit b9de69fe44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,7 +125,11 @@ if args.e:
rlist, _, _ = select([sys.stdin], [], [], args.t)
if rlist:
last_message_stamp = time.time()
stashed_lines.append(sys.stdin.readline())
r_line = sys.stdin.readline()
if len(r_line) == 0:
#EOFError. pipe broken?
sys.exit(-1)
stashed_lines.append(r_line)
if len(stashed_lines) >= 1 and (args.t is None or time.time() - last_message_stamp > args.t):
# emit event trigger(s) to syslog