From: Rishabh Dave Date: Wed, 3 Apr 2024 05:41:29 +0000 (+0530) Subject: qa/vstart_runner: don't let command run after timeout X-Git-Tag: v20.0.0~2139^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8bc23e50df7b2f4ee4792271a2aad43614caf00f;p=ceph.git qa/vstart_runner: don't let command run after timeout Parameter "timeout" is accepted by LocalRemote.run() but the method doesn't do anything about it besides accepting it. Thus, this parameter has no effect. In LocalRemote.run(), pass this parameter to LocalRemoteProcess.wait() and from this method pass it to subprocess.Popen.communicate(). Thus, command will be terminated by subprocess module at seconds specified by "timeout" parameter. IOW, "timeout" parameter will have an effect. Fixes: https://tracker.ceph.com/issues/65533 Signed-off-by: Rishabh Dave --- diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 8d9dc6f1845c..b5dbe3c5f97c 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -233,7 +233,7 @@ class LocalRemoteProcess(object): else: self.stderr.write(err) - def wait(self): + def wait(self, timeout=None): # Null subproc.stdin so communicate() does not try flushing/closing it # again. if self.stdin is not None and self.stdin.closed: @@ -249,7 +249,7 @@ class LocalRemoteProcess(object): else: return - out, err = self.subproc.communicate() + out, err = self.subproc.communicate(timeout=timeout) out, err = rm_nonascii_chars(out), rm_nonascii_chars(err) self._write_stdout(out) self._write_stderr(err) @@ -488,7 +488,7 @@ sudo() { ) if wait: - proc.wait() + proc.wait(timeout) return proc