From: Paul K. <pk...@gm...> - 2009-10-02 20:36:26
|
On 2009-10-01, at 10:26 PM, Jianshi Huang wrote: > I ran the following code, which should output "hello\nworld" to > /tmp/test.log. But the file's lost if the child process runs (quit). > > (with-open-file (f "/tmp/test.log" > :direction :output > :if-does-not-exist :create > :if-exists :supersede) > (let ((child (sb-posix:fork))) > (if (zerop child) > (progn (print 'hello f) (force-output f) (quit)) > (progn (print 'world f) (sb-posix:waitpid child *0*))))) ; I > assume > > I tried similar code in AllegroCL and it works fine. I think it might > be a bug. SB-EXT:QUIT runs any pending unwind handler (in the current thread) and *exit-hooks* before terminating the process. (QUIT :RECKLESSLY-P T) to avoid that, which I assume is closer to ACL's behaviour. I'm not certain how :supersede is implemented exactly, but assuming you want to quit normally, you can try using :overwrite instead. Paul Khuong |