mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-08 14:17:57 +00:00
Solved EOL bug
This commit is contained in:
15
main.py
15
main.py
@@ -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:
|
||||||
for line in master:
|
try:
|
||||||
ts = datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
|
for line in master:
|
||||||
log_file.write(f"{ts} {line}")
|
ts = datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
|
||||||
log_file.flush()
|
log_file.write(f"{ts} {line}")
|
||||||
print(line, end='')
|
log_file.flush()
|
||||||
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user