mod_auth_external/mod_auth_external.lua
changeset 197 2686221255cf
parent 168 cd8492748985
child 217 3da3d6480e65
--- a/mod_auth_external/mod_auth_external.lua	Wed Jul 07 17:31:31 2010 +0800
+++ b/mod_auth_external/mod_auth_external.lua	Wed Jul 07 13:27:46 2010 +0200
@@ -30,10 +30,14 @@
 local pid;
 local readfile;
 local writefile;
+
 local function send_query(text)
-	-- if not proc then
+	if pid and lpc.wait(pid,1) ~= nil then
+    	    log("debug","error, process died, force reopen");
+	    pid=nil;
+	end
 	if not pid then
-		log("debug", "Opening process");
+		log("debug", "Opening process " .. command);
 		-- proc = process.popen(command);
 		pid, writefile, readfile = lpc.run(command);
 	end
@@ -44,6 +48,7 @@
 	end
 	-- proc:write(text);
 	-- proc:flush();
+
 	writefile:write(text);
 	writefile:flush();
 	if script_type == "ejabberd" then