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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 31 13:03:27 CDT 2010


Author: russell
Date: Wed Mar 31 13:03:26 2010
New Revision: 167

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=167
Log:
Go back to more reliable way of stopping Asterisk, but in a pre-python2.6 compatible way

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=167&r1=166&r2=167
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Wed Mar 31 13:03:26 2010
@@ -13,6 +13,7 @@
 
 import sys
 import os
+import signal
 import time
 import shutil
 import subprocess
@@ -113,23 +114,14 @@
         Example Usage:
         asterisk.stop()
         """
+        os.kill(self.process.pid, signal.SIGTERM)
+        time.sleep(5.0)
         try:
-            self.cli_exec("core stop now")
-            self.cli_exec("stop now")
+            if not self.process.poll():
+                os.kill(self.process.pid, signal.SIGKILL)
         except OSError:
             pass
         self.process.wait()
-        #
-        # Requires Python 2.6 :-(
-        #
-        # self.process.terminate()
-        # time.sleep(5.0)
-        # try:
-        #     if not self.process.poll():
-        #         self.process.kill()
-        # except OSError:
-        #     pass
-        # (self.stdout, self.stderr) = self.process.communicate()
         return self.process.returncode
 
     def install_config(self, cfg_path):




More information about the asterisk-commits mailing list