MCPcopy Create free account
hub / github.com/DFHack/dfhack / io_popen

Function io_popen

depends/lua/src/liolib.c:276–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274
275
276static int io_popen (lua_State *L) {
277 const char *filename = luaL_checkstring(L, 1);
278 const char *mode = luaL_optstring(L, 2, "r");
279 LStream *p = newprefile(L);
280 luaL_argcheck(L, ((mode[0] == 'r' || mode[0] == 'w') && mode[1] == '\0'),
281 2, "invalid mode");
282 p->f = l_popen(L, filename, mode);
283 p->closef = &io_pclose;
284 return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
285}
286
287
288static int io_tmpfile (lua_State *L) {

Callers

nothing calls this directly

Calls 2

newprefileFunction · 0.85
luaL_fileresultFunction · 0.85

Tested by

no test coverage detected