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

View File

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