[luatex] Can't open pipe in .tex doc

Reinhard Kotucha reinhard.kotucha at web.de
Tue Aug 14 00:33:04 CEST 2012

On 2012-08-14 at 07:39:28 +0930, Michael Talbot-Wilson wrote:

 > $ cat textst7.tex && luatex textst7
 > \directlua {a = io.popen("ls /")
 > if a == nil then
 >     print "Woe is me!"
 > else
 >     for c in a:lines(1) do print(c) end
 >     io.close(a)
 > end}
 > \bye
 > This is LuaTeX, Version beta-0.70.2-2012062812 (TeX Live 2012)
 >   restricted \write18 enabled.
 > (./textst7.texWoe is me!
 >   )
 > No pages of output.
 > Transcript written on textst7.log.
 > Why?  Works as standalone lua.
 > What I want is for my TeX document to read BLOBs (PDF images) and
 > other stuff from a PostgreSQL database.  So "ls /" would become a psql
 > (SQL) command.

I assume that you are wondering about

 > No pages of output.

print() prints to screen (as in standalone Lua or texlua).  If you
want to write to a PDF file, use tex.print() instead of print().

In order to get the documentation, run

  texdoc luatex

on the command line.


Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the luatex mailing list