Solved EOL bug

This commit is contained in:
Kevin Veen-Birkenbach 2025-06-19 14:49:50 +02:00
parent 7dd8fd4a5f
commit 0114b30824
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E

15
main.py
View File

@ -162,12 +162,17 @@ if __name__ == "__main__":
text=True
)
os.close(slave_fd)
import errno
with os.fdopen(master_fd) as master:
for line in master:
ts = datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
log_file.write(f"{ts} {line}")
log_file.flush()
print(line, end='')
try:
for line in master:
ts = datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
log_file.write(f"{ts} {line}")
log_file.flush()
print(line, end='')
except OSError as e:
if e.errno != errno.EIO:
raise
proc.wait()
rc = proc.returncode
else: