From fd0a831134c7dd4beae511a15efff996f92582de Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 22 Oct 2013 19:11:53 +0100 Subject: [PATCH 01/15] inspect-cm.py: on errors, exit rather than blocking forever --- examples/client/python/inspect-cm.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/examples/client/python/inspect-cm.py b/examples/client/python/inspect-cm.py index c653cf7..0564078 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() -- 1.8.4.rc3