Changeset

6503:8437058c4226

mod_admin_telnet: Soft-reqire util.pposix for server:memory()
author Kim Alvefur <zash@zash.se>
date Mon, 27 Oct 2014 11:12:08 +0100
parents 6501:71b6e8b48a12
children 6504:e1659f32852e
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sun Oct 26 20:57:06 2014 +0100
+++ b/plugins/mod_admin_telnet.lua	Mon Oct 27 11:12:08 2014 +0100
@@ -27,6 +27,7 @@
 local cert_verify_identity = require "util.x509".verify_identity;
 local envload = require "util.envload".envload;
 local envloadfile = require "util.envload".envloadfile;
+local has_pposix, pposix = pcall(require, "util.pposix");
 
 local commands = module:shared("commands")
 local def_env = module:shared("env");
@@ -322,7 +323,7 @@
 end
 
 function def_env.server:memory()
-	if not pposix.meminfo then
+	if not has_pposix or not pposix.meminfo then
 		return true, "Lua is using "..collectgarbage("count");
 	end
 	local mem, lua_mem = pposix.meminfo(), collectgarbage("count");