From a6422a860dcab6ba0572e5b4b9fef70cd651ff44 Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Sun, 24 Oct 2021 21:47:49 +0200 Subject: [PATCH] tests: remotehost: Disable pipe buffering Before, we could loose some events because of pipe buffering. I saw this problem when running "ubus listen" or "logread -f" and waiting some specific events. After disabling buffering this works much better. Signed-off-by: Janusz Dziedzic --- tests/hwsim/remotehost.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index 0799b951f..9d7c657a1 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -24,7 +24,7 @@ def execute_thread(command, reply): err = tempfile.TemporaryFile() try: status = 0 - buf = subprocess.check_output(command, stderr=err).decode() + buf = subprocess.check_output(command, stderr=err, bufsize=0).decode() except subprocess.CalledProcessError as e: status = e.returncode err.seek(0) @@ -181,7 +181,8 @@ class Host(): _cmd = self.name + " proc_run: " + ' '.join(cmd) logger.debug(_cmd) err = tempfile.TemporaryFile() - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=err) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=err, + bufsize=0) proc.reaper_file = filename return proc