mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
skynet.getenv can return empty string
This commit is contained in:
@@ -343,12 +343,7 @@ function skynet.exit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function skynet.getenv(key)
|
function skynet.getenv(key)
|
||||||
local ret = c.command("GETENV",key)
|
return c.command("GETENV",key)
|
||||||
if ret == "" then
|
|
||||||
return
|
|
||||||
else
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function skynet.setenv(key, value)
|
function skynet.setenv(key, value)
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ require "skynet.manager" -- import skynet.launch, ...
|
|||||||
local memory = require "memory"
|
local memory = require "memory"
|
||||||
|
|
||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
local sharestring = tonumber(skynet.getenv "sharestring")
|
local sharestring = tonumber(skynet.getenv "sharestring" or 4096)
|
||||||
memory.ssexpand(sharestring or 4096)
|
memory.ssexpand(sharestring)
|
||||||
|
|
||||||
local standalone = skynet.getenv "standalone"
|
local standalone = skynet.getenv "standalone"
|
||||||
|
|
||||||
local launcher = assert(skynet.launch("snlua","launcher"))
|
local launcher = assert(skynet.launch("snlua","launcher"))
|
||||||
skynet.name(".launcher", launcher)
|
skynet.name(".launcher", launcher)
|
||||||
|
|
||||||
local harbor_id = tonumber(skynet.getenv "harbor")
|
local harbor_id = tonumber(skynet.getenv "harbor" or 0)
|
||||||
if harbor_id == 0 then
|
if harbor_id == 0 then
|
||||||
assert(standalone == nil)
|
assert(standalone == nil)
|
||||||
standalone = true
|
standalone = true
|
||||||
|
|||||||
Reference in New Issue
Block a user