On Tue, 1 Jun 2010 15:55:32 +0100 Martin Simmons martin@lispworks.com wrote:
Check the value returned by c-wait, because it sounds like it is getting an error. If it returns -1, then you need to check errno.
You should also use unwind-protect to ensure that foreign-free is called (or use with-foreign-pointer instead of foreign-alloc and foreign-free).
When I tried, CLISP crashed.
I don't know about CLISP, but your code will not work reliably if the Lisp implementation calls wait itself (e.g. in response to SIGCHLD). If possible, I would use a implementation-supplied function instead of trying to implement execute-program yourself.
I hoped to be able to get a common implementation of that function but given the time I am wasting and the amount of low-level and implementation-dependant stuff I will follow your advice. Luckily both CFFI and SBCL come with similar functions.
__Martin