[svn-commits] mnicholson: testsuite/asterisk/trunk r358 - /asterisk/trunk/asttest/lib/lua/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 7 11:03:26 CDT 2010


Author: mnicholson
Date: Mon Jun  7 11:03:23 2010
New Revision: 358

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=358
Log:
Added more error checking to asterisk:cli() and added a 5 minute timeout for commands to complete.

Modified:
    asterisk/trunk/asttest/lib/lua/astlib.lua

Modified: asterisk/trunk/asttest/lib/lua/astlib.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/lib/lua/astlib.lua?view=diff&rev=358&r1=357&r2=358
==============================================================================
--- asterisk/trunk/asttest/lib/lua/astlib.lua (original)
+++ asterisk/trunk/asttest/lib/lua/astlib.lua Mon Jun  7 11:03:23 2010
@@ -52,11 +52,19 @@
 	rawset(self, "proc", p)
 end
 
+-- note this timesout after five minutes
 function asterisk:cli(command)
 	local p = proc.exec_io(self.asterisk_binary,
 		"-r", "-x", command,
 		"-C", self.asterisk_conf
 	)
+
+	-- wait up to 5 minutes for the process to exit.  If the process does
+	-- not exit within 5 minutes, return a error.
+	local res, err = p:wait(300000)
+	if not res then
+		return res, err
+	end
 
 	return p.stdout:read("*a")
 end




More information about the svn-commits mailing list