Skip to content

Commit

Permalink
cli: avoid skipping empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdanp committed Jan 13, 2024
1 parent 1b037cf commit 76e10e8
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions dramatiq/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,20 +338,13 @@ def watch_logs(log_filename, pipes, stop):
for event in events:
try:
while event.poll():
# StreamHandler writes newlines into the pipe separately
# from the actual log entry; to avoid back-to-back newlines
# in the events pipe (causing multiple entries on a single
# line), discard newline-only data from the pipe
try:
data = event.recv_bytes()
except EOFError:
event.close()
raise

data = data.decode("utf-8", errors="replace")
if not data.rstrip("\n"):
continue

log_file.write(data)
log_file.flush()
except BrokenPipeError:
Expand Down

0 comments on commit 76e10e8

Please sign in to comment.