test-client.py: Close pipes and print logs on timeout failures
If we failed on process wait, we didn't close the pipes and no clear output of what happened was exposed. So use a finally stanza to close the pipes and print stdout and stderr on failure.
This commit is contained in:

committed by
Thomas Haller

parent
6a58c55ca4
commit
36bd0565b7
@@ -425,15 +425,29 @@ class AsyncProcess():
|
|||||||
|
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
|
error = False
|
||||||
|
try:
|
||||||
Util.popen_wait(self._p, 2000)
|
Util.popen_wait(self._p, 2000)
|
||||||
|
except Exception as e:
|
||||||
(returncode, stdout, stderr) = (self._p.returncode, self._p.stdout.read(), self._p.stderr.read())
|
error = True
|
||||||
|
raise e
|
||||||
|
finally:
|
||||||
|
(returncode, stdout, stderr) = (self._p.returncode,
|
||||||
|
self._p.stdout.read(),
|
||||||
|
self._p.stderr.read())
|
||||||
|
|
||||||
self._p.stdout.close()
|
self._p.stdout.close()
|
||||||
self._p.stderr.close()
|
self._p.stderr.close()
|
||||||
self._p = None
|
self._p = None
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print(stdout)
|
||||||
|
print(stderr)
|
||||||
|
|
||||||
|
try:
|
||||||
self._complete_cb(self, returncode, stdout, stderr)
|
self._complete_cb(self, returncode, stdout, stderr)
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user