[luatex] status of io.popen() on windows

Paweł Jackowski P.Jackowski at gust.org.pl
Thu Dec 31 11:23:36 CET 2009


Taco Hoekwater wrote:
> Manuel Pégourié-Gonnard wrote:
>> Hi,
>>
>> According to the Lua reference manual entry for io.popen(), "This 
>> function is
>> system dependent and is not available on all platforms.". What's its 
>> status in
>> LuaTeX on windows (and other platforms, but I guess windows is the 
>> problematic
>> platform due to lack of fork() etc)?
> 
> Have you (or anyone) tried? I think it should work just fine on windows.

Lets have ioecho program working as

	for line in io.lines() do io.write(line) end

and poppen.lua

	local h = io.popen("ioecho", "w")
	h:write("Aqq")

This works fine:

	lua popen.lua

The following crashes (attempt to index h, a nil value)

	luatex -lua popen.lua

(which is what I expected due to the safe mode).
Once we wrap popen code with tex

	\directlua{
		% dofile "popen.lua"
		local h = io.popen("luatex -lua echo.lua", "w")
		h:write("Aqq")
	}\end

This works fine

	luatex popen.tex

So dofile case does.
-- 
Pawe/l Jackowski
P.Jackowski at gust.org.pl


More information about the luatex mailing list