[NTG-context] piping output from external command

Peter Münster pmlists at free.fr
Sun Jan 30 23:19:00 CET 2011


Hello,

This used to work with pdftex:

\starttext
\input "\string|echo hello world"
\stoptext

What's the recommended way, to do this in mkiv?

I've defined \Pipe{} like this:

\startluacode
userdata = userdata or {}
function userdata.pipe(c)
    local h = io.popen(c)
    context(h:read"*a")
    h:close()
end
\stopluacode
\def\Pipe#1{\ctxlua{userdata.pipe"#1"}}

But I suppose that there is already a nice command in the core... ;)

-- 
           Peter


More information about the ntg-context mailing list