Now comes the problem: how to limit a popen process time: we can't have the webserver hanging forever. Note that using popen() is not async. Our event managment only covers sockets (and maybe pipes): we can't sleep an fthread until a popen()ed process writes some stuff for us to read.
The generic way to do this is: 1) Launch a timeout process, which sleeps for N seconds then dies. 2) Launch our child process. Monitor both processes in a loop, with a delay between polling their status. When one process ends, kill the other one. The problem with this is that we have to get the output back. The child will block if we fill the pipe, so we have to read it, but there's no asych I/O for FILE*. The only way to handle this is to spawn yet ANOTHER process which does the spawning and reads the input. This one buffers all the input, then writes it, and dies once it is done (it may hang until we read). This one can't do the write until either the child dies, which sends EOF on the file it is reading, or the child is killed (in which case we don't care). The main thing here is that the reader process is known, so it is reliable and can't loop forever. The biggest hassle here is propagating any error codes back, making sure we distinguish an error in the child, and a kill. [The alternative to the above is to use something lower level than popen, which uses unix file handles] -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language