lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Dec 28, 2013 at 11:04 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> function popen(prog,mode)
> local cond,msg,code = io.popen(prog,mode):close()
> if code==127 then error("'"..prog.."' not found") end
> return io.popen(prog,mode)
> end

Which ends up running the same program twice, problem if a heavy
process or not idempotent.

I have to agree with Luiz, use luaposix.  You can do all that lovely
fork and exec stuff, and signal away like it was 1976

steve d.