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 <janusz.dziedzic@gmail.com>
This commit is contained in:
Janusz Dziedzic 2021-10-24 21:47:49 +02:00 committed by Jouni Malinen
parent 5530688b92
commit a6422a860d

View file

@ -24,7 +24,7 @@ def execute_thread(command, reply):
err = tempfile.TemporaryFile() err = tempfile.TemporaryFile()
try: try:
status = 0 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: except subprocess.CalledProcessError as e:
status = e.returncode status = e.returncode
err.seek(0) err.seek(0)
@ -181,7 +181,8 @@ class Host():
_cmd = self.name + " proc_run: " + ' '.join(cmd) _cmd = self.name + " proc_run: " + ' '.join(cmd)
logger.debug(_cmd) logger.debug(_cmd)
err = tempfile.TemporaryFile() 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 proc.reaper_file = filename
return proc return proc