webmcp

diff framework/cgi-bin/webmcp-wrapper.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/cgi-bin/webmcp-wrapper.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +#!/usr/bin/env lua
     1.5 +
     1.6 +local func, errmsg = loadfile('webmcp.lua')
     1.7 +
     1.8 +if func then
     1.9 +  local result
    1.10 +  result, errmsg = pcall(func)
    1.11 +  if result then
    1.12 +    errmsg = nil
    1.13 +  end
    1.14 +end
    1.15 +
    1.16 +if errmsg and not (cgi and cgi.data_sent) then
    1.17 +  print('Status: 500 Internal Server Error')
    1.18 +  print('Content-type: text/plain')
    1.19 +  print()
    1.20 +  print('500 Internal Server Error')
    1.21 +  print()
    1.22 +  print(errmsg)
    1.23 +  print()
    1.24 +  print('(caught by webmcp-wrapper.lua)')
    1.25 +  os.exit(1)
    1.26 +end

Impressum / About Us