fix error output format

This commit is contained in:
David Feng
2015-03-03 17:00:29 +08:00
parent cc136f996f
commit fee96045ee

View File

@@ -87,7 +87,7 @@ static const char * load_config = "\
local config_name = ...\ local config_name = ...\
local f = assert(io.open(config_name))\ local f = assert(io.open(config_name))\
local code = assert(f:read \'*a\')\ local code = assert(f:read \'*a\')\
local function getenv(name) return assert(os.getenv(name), \'os.getenv failed\' .. name) end\ local function getenv(name) return assert(os.getenv(name), \'os.getenv() failed: \' .. name) end\
code = string.gsub(code, \'%$([%w_%d]+)\', getenv)\ code = string.gsub(code, \'%$([%w_%d]+)\', getenv)\
f:close()\ f:close()\
local result = {}\ local result = {}\
@@ -118,13 +118,13 @@ main(int argc, char *argv[]) {
int err = luaL_loadstring(L, load_config); int err = luaL_loadstring(L, load_config);
assert(err == LUA_OK); assert(err == LUA_OK);
lua_pushstring(L, config_file); lua_pushstring(L, config_file);
err = lua_pcall(L, 1, 1, 0); err = lua_pcall(L, 1, 1, 0);
if (err) { if (err) {
fprintf(stderr,"%s\n",lua_tostring(L,-1)); fprintf(stderr,"%s\n",lua_tostring(L,-1));
lua_close(L); lua_close(L);
return 1; return 1;
} }
_init_env(L); _init_env(L);
config.thread = optint("thread",8); config.thread = optint("thread",8);