fix binary format
This commit is contained in:
@ -75,16 +75,20 @@ def main():
|
||||
else:
|
||||
delay_per_byte = 0.0
|
||||
|
||||
_CHUNK = 4096
|
||||
loop = 0
|
||||
try:
|
||||
while True:
|
||||
loop += 1
|
||||
print(f"[loop {loop}] {args.file}")
|
||||
with open(args.file, "rb") as f:
|
||||
for line in f:
|
||||
os.write(master_fd, line)
|
||||
while True:
|
||||
chunk = f.read(_CHUNK)
|
||||
if not chunk:
|
||||
break
|
||||
os.write(master_fd, chunk)
|
||||
if delay_per_byte > 0:
|
||||
time.sleep(delay_per_byte * len(line))
|
||||
time.sleep(delay_per_byte * len(chunk))
|
||||
except KeyboardInterrupt:
|
||||
print("\nОстановлено.")
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user