Skip to content

Commit b760828

Browse files
authored
Merge pull request #4754 from myk002/myk_unbreak_luacov
[Core] don't harden Lua io.popen if Lua coverage monitoring is enabled
2 parents bfaa447 + a09bfac commit b760828

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

library/LuaTools.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,11 +1898,13 @@ lua_State *DFHack::Lua::Open(color_ostream &out, lua_State *state)
18981898
luaL_setfuncs(state, dfhack_coro_funcs, 0);
18991899
lua_pop(state, 1);
19001900

1901-
// replace some io functions
1902-
lua_getglobal(state, "io");
1903-
lua_pushnil(state);
1904-
lua_setfield(state, -2, "popen");
1905-
lua_pop(state, 1);
1901+
// remove some io functions (if coverage monitoring, which needs them, is not enabled)
1902+
if (!getenv("DFHACK_ENABLE_LUACOV")) {
1903+
lua_getglobal(state, "io");
1904+
lua_pushnil(state);
1905+
lua_setfield(state, -2, "popen");
1906+
lua_pop(state, 1);
1907+
}
19061908

19071909
// replace some os functions
19081910
lua_getglobal(state, "os");

0 commit comments

Comments
 (0)