mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 21:50:17 +01:00
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:
parent
6a58c55ca4
commit
36bd0565b7
1 changed files with 20 additions and 6 deletions
|
|
@ -425,15 +425,29 @@ class AsyncProcess():
|
|||
|
||||
self.start()
|
||||
|
||||
Util.popen_wait(self._p, 2000)
|
||||
error = False
|
||||
try:
|
||||
Util.popen_wait(self._p, 2000)
|
||||
except Exception as e:
|
||||
error = True
|
||||
raise e
|
||||
finally:
|
||||
(returncode, stdout, stderr) = (self._p.returncode,
|
||||
self._p.stdout.read(),
|
||||
self._p.stderr.read())
|
||||
|
||||
(returncode, stdout, stderr) = (self._p.returncode, self._p.stdout.read(), self._p.stderr.read())
|
||||
self._p.stdout.close()
|
||||
self._p.stderr.close()
|
||||
self._p = None
|
||||
|
||||
self._p.stdout.close()
|
||||
self._p.stderr.close()
|
||||
self._p = None
|
||||
if error:
|
||||
print(stdout)
|
||||
print(stderr)
|
||||
|
||||
self._complete_cb(self, returncode, stdout, stderr)
|
||||
try:
|
||||
self._complete_cb(self, returncode, stdout, stderr)
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue