From: Gunter K. <gu...@pe...> - 2016-07-29 10:54:28
|
> At least with sbcl there are a number of unix-like primitives which are > implemented, see > https://github.com/sbcl/sbcl/blob/master/src/code/unix.lisp > and provide essentially the same tools that come with "batteries > included" python. In particular the system call mkstemp is provided > see at lines 186-206. This is an interesting resource. But using undocumented stuff that isn't portable to other lisps for implementing a nice-to-have in a portable program that is meant for production use... > > Deleting these temporaries when exiting maxima is perhaps not obvious, > since wrapping the call in unwind-protect could serve to delete the file > immediately after use, but i don't see how it could keep the file > for the whole maxima session and then delete it. Unwind-protect is a cool concept I didn't know about. Quite like making c++ keep a spinlock alive for exactly the right amount of time by placing it within a block. I think one way to make sure that the file is kept long enough that we are sure gnuplot can finish its work first would be to wrap the whole maxima session within one big unwind-protect. Actually having an atexit() function for maths would be quite an absurd kind of concept feeling like "too much Mozart"... In the meantime I have stumbled upon a additional problem: What if a maxima batch file plots something big to a file and then ends in a quit(): Linux will keep the file alive after it has officially already been deleted in case that it has already been opened by gnuplot. We will encounter bug reports about that. Watching the life time of the gnuplot process instead? Currently I tend to think that Robert is right that the problem isn't big enough to justify the remedies I could think of. But unwind-protect really is nice. Thanks again! Kind regards, Gunter. |