skynet.getenv can return empty string

This commit is contained in:
Cloud Wu
2016-04-18 11:55:39 +08:00
parent 4fe098713f
commit b124d4c1b8
2 changed files with 4 additions and 9 deletions

View File

@@ -343,12 +343,7 @@ function skynet.exit()
end
function skynet.getenv(key)
local ret = c.command("GETENV",key)
if ret == "" then
return
else
return ret
end
return c.command("GETENV",key)
end
function skynet.setenv(key, value)

View File

@@ -4,15 +4,15 @@ require "skynet.manager" -- import skynet.launch, ...
local memory = require "memory"
skynet.start(function()
local sharestring = tonumber(skynet.getenv "sharestring")
memory.ssexpand(sharestring or 4096)
local sharestring = tonumber(skynet.getenv "sharestring" or 4096)
memory.ssexpand(sharestring)
local standalone = skynet.getenv "standalone"
local launcher = assert(skynet.launch("snlua","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
assert(standalone == nil)
standalone = true