1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2024-12-26 17:38:21 +01:00

fix bug with the new plugin interface

This commit is contained in:
lxsang 2018-10-07 16:13:55 +02:00
parent 06b2ec0e8f
commit 76e5ca2430
2 changed files with 13 additions and 1 deletions

View File

@ -105,7 +105,7 @@ function std.ws.write_bytes(arr)
std.ws_b(HTTP_REQUEST.id,arr)
end
function std.ws.enable()
return HTTP_REQUEST.query ~= nil and HTTP_REQUEST.query["__web_socket__"] == "1"
return HTTP_REQUEST ~= nil and HTTP_REQUEST.request["__web_socket__"] == "1"
end
function std.ws.close(code)
std.ws_close(HTTP_REQUEST.id,code)

View File

@ -10,6 +10,8 @@
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#include <pwd.h>
#include <grp.h>
@ -118,6 +120,15 @@ static int l_waitpid(lua_State* L)
int status;
waitpid(pid, &status, 0);
lua_pushnumber(L, status);
return 1;
}
static int l_kill(lua_State* L)
{
int pid = luaL_checknumber(L,1);
if(pid == -1) pid = getpid();
int status = kill(pid, SIGKILL);
lua_pushnumber(L, status);
return 1;
}
static int l_setuid(lua_State* L)
{
@ -610,6 +621,7 @@ static const struct luaL_Reg _lib [] = {
{"setuid", l_setuid},
{"setgid", l_setgid},
{"fork", l_fork},
{"kill", l_kill},
{"waitpid", l_waitpid},
{"chown",l_chown},
{"delete", l_delete},