mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-02 23:18:44 +00:00
Add ProgramUniprocess to redbean (#364)
This commit is contained in:
parent
1e3c5e10ad
commit
abac6f729c
2 changed files with 17 additions and 0 deletions
|
@ -930,6 +930,10 @@ FUNCTIONS
|
|||
someone with a slow internet connection who's downloading big
|
||||
files unhappy.
|
||||
|
||||
ProgramUniprocess([bool]) → bool
|
||||
Same as the -u flag if called from .init.lua. Can be used to
|
||||
configure the uniprocess mode. The current value is returned.
|
||||
|
||||
Slurp(filename:str) → str
|
||||
Reads file data from local file system.
|
||||
|
||||
|
|
|
@ -5015,6 +5015,18 @@ static int LuaProgramSslTicketLifetime(lua_State *L) {
|
|||
return LuaProgramInt(L, ProgramSslTicketLifetime);
|
||||
}
|
||||
|
||||
static int LuaProgramUniprocess(lua_State *L) {
|
||||
OnlyCallFromInitLua(L, "ProgramUniprocess");
|
||||
if (!lua_isboolean(L, 1) && !lua_isnoneornil(L, 1))
|
||||
return luaL_argerror(L, 1, "invalid uniprocess mode; boolean expected");
|
||||
|
||||
lua_pushboolean(L, uniprocess);
|
||||
if (!IsWindows()) { // uniprocess can't be disabled on Windows yet
|
||||
if (lua_isboolean(L, 1)) uniprocess = lua_toboolean(L, 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static dontinline int LuaProgramString(lua_State *L, void P(const char *)) {
|
||||
P(luaL_checkstring(L, 1));
|
||||
return 0;
|
||||
|
@ -5644,6 +5656,7 @@ static const luaL_Reg kLuaFuncs[] = {
|
|||
{"ProgramSslTicketLifetime", LuaProgramSslTicketLifetime}, //
|
||||
{"ProgramTimeout", LuaProgramTimeout}, //
|
||||
{"ProgramUid", LuaProgramUid}, //
|
||||
{"ProgramUniprocess", LuaProgramUniprocess}, //
|
||||
{"Route", LuaRoute}, //
|
||||
{"RouteHost", LuaRouteHost}, //
|
||||
{"RoutePath", LuaRoutePath}, //
|
||||
|
|
Loading…
Add table
Reference in a new issue