[asterisk-commits] russell: testsuite/asterisk/trunk r795 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 28 14:46:52 CDT 2010


Author: russell
Date: Tue Sep 28 14:46:48 2010
New Revision: 795

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=795
Log:
Catch the OSError exception in cli_exec() when trying to run an asterisk -rx command.

Modified:
    asterisk/trunk/lib/python/asterisk/asterisk.py

Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=795&r1=794&r2=795
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Tue Sep 28 14:46:48 2010
@@ -305,8 +305,13 @@
             process = subprocess.Popen(cmd)
             return ""
 
-        process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-                                   stderr=subprocess.STDOUT)
+        try:
+            process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                                       stderr=subprocess.STDOUT)
+        except OSError:
+            print "Failed to execute command: %s" % str(cmd)
+            return ""
+
         output = ""
         try:
             for l in process.stdout.readlines():




More information about the asterisk-commits mailing list