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 <ridave@redhat.com>
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:
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)
)
if wait:
- proc.wait()
+ proc.wait(timeout)
return proc