From b9db61467426d0fb99880da41f5faa4bd3292b64 Mon Sep 17 00:00:00 2001 From: Flawed <33593723+ff14wed@users.noreply.github.com> Date: Wed, 18 Jan 2023 22:24:13 -0800 Subject: [PATCH] The hack to sync r2 output isn't needed on linux --- utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils.py b/utils.py index c035384..3f21cab 100644 --- a/utils.py +++ b/utils.py @@ -1,5 +1,6 @@ import sys import time +import os def eprint(*args, **kwargs): @@ -25,11 +26,10 @@ def sync_r2_output(r2): Read stuff from the process pipe until it stops being stupid. """ - for i in range(10): - p = r2.process.stdout.read(1) - if len(p) > 0: - break - time.sleep(1) + time.sleep(1) + os.set_blocking(r2.process.stdout.fileno(), False) + p = r2.process.stdout.read(1) + os.set_blocking(r2.process.stdout.fileno(), True) output = r2.cmd(f"?vi 123").strip() if output != "123": raise Exception("R2 state never got synced")