Skip to content

Commit a3eeb1f

Browse files
committed
Capture and propagate exception issuing rtpproxy commands.
1 parent f762295 commit a3eeb1f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

python/tools/rtpp_query.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2
1+
#!/usr/bin/env python
22
#
33
# Copyright (c) 2015 Sippy Software, Inc. All rights reserved.
44
#
@@ -36,7 +36,7 @@ class command_runner(object):
3636
fin = None
3737
fout = None
3838
rval = 0
39-
maxfails = 5
39+
maxfails = 0
4040

4141
def __init__(self, rc, commands = None, fin = None, fout = None):
4242
self.responses = []
@@ -62,8 +62,12 @@ def issue_next_cmd(self):
6262
return
6363
self.rc.send_command(command, self.got_result)
6464

65-
def got_result(self, result):
66-
if result == None:
65+
def got_result(self, result, ex=None):
66+
if ex is not None:
67+
self.rval = ex
68+
ED2.breakLoop()
69+
return
70+
if result is None:
6771
if self.maxfails == 0:
6872
self.rval = 2
6973
ED2.breakLoop()
@@ -148,4 +152,6 @@ def usage():
148152
Timeout(crun.timeout, timeout)
149153
ED2.loop()
150154
rc.shutdown()
155+
if isinstance(crun.rval, Exception):
156+
raise crun.rval
151157
sys.exit(crun.rval)

0 commit comments

Comments
 (0)