lua-users home
lua-l archive

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



I need some library that implements a
fork function

Not exactly what you want, but try Steve Donovan's bidirectional implmentation of popen, here:

http://mysite.mweb.co.za/residents/sdonovan/popen.zip

This allows you start a program in a subprocess (unlike fork(), you don't get a copy of the current process and address space). You get back a file-type object which works like the standard io library's popen() except that you can read from and write to it for full, bidirectional control of the subprocess. Steve's implmentation happens to use fork() under Unix, but relies on CreateProcess() under Windows.

Or for another approach, try Daniel Quintela's neat and well-documented LuaTask library:

http://luaforge.net/projects/luatask/

The only implementation of fork() I know of on Windows is provided by Cygwin, which means porting your program to the Cygwin API. IIRC there are also some unavoidable security "tricks" needed to make fork() work, which might make you not want to use Cygwin at all.