summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-22 19:11:53 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-11 16:48:38 +0000
commit45d958eeff097e1df862cbbbb760bf5831201642 (patch)
treed3dec5c7586129e9750d0219dfe3b5c0c2ba38cc
parent7ffbde3f23170ccc219ca969052efaf9c9a535bf (diff)
inspect-cm.py: on errors, exit rather than blocking forever
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71048 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--examples/client/python/inspect-cm.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/examples/client/python/inspect-cm.py b/examples/client/python/inspect-cm.py
index c653cf716..0564078a9 100644
--- a/examples/client/python/inspect-cm.py
+++ b/examples/client/python/inspect-cm.py
@@ -28,9 +28,11 @@ def describe(cm):
print("\t\tNo default")
def manager_prepared_cb(cm, result, loop):
- cm.prepare_finish(result)
- describe(cm)
- loop.quit()
+ try:
+ cm.prepare_finish(result)
+ describe(cm)
+ finally:
+ loop.quit()
def inspect(name):
cm = Tp.ConnectionManager(
@@ -41,13 +43,14 @@ def inspect(name):
cm.prepare_async(None, cm, loop)
def cms_cb(source, result, loop):
- cms = Tp.list_connection_managers_finish(result)
-
- for cm in cms:
- describe(cm)
- print("")
-
- loop.quit()
+ try:
+ cms = Tp.list_connection_managers_finish(result)
+
+ for cm in cms:
+ describe(cm)
+ print("")
+ finally:
+ loop.quit()
if __name__ == '__main__':
loop = GObject.MainLoop()