[pg-cvs] patch: no-unlink parameter for temporary file creation

James Vasile james at hackervisions.org
Sat Dec 18 04:56:00 UTC 2010


In osicat's fd-streams.lisp, there is a function, make-fd-stream.  The
sbcl version ignores the pathname parameter, but I'm not sure why.  If
you set the pathname parameter in the stream, you can then recover the
pathname from the stream later on.  And if you don't unlink tmp files
immediately after creation, you can do stuff like this:

(let* ((stream (open-temporary-file :no-unlink t))
       (fname (namestring (pathname stream))))
  (write-data-to-temp-file stream)
  (close stream)
  (do-shell-command-on-temp-file fname)
  (nix:unlink fname))

Sure, that's not the prettiest thing you'll ever do, but it works pretty
well when you need it.  If you want osicat to support that use case, I
offer a couple small patches that don't ignore pathname in
make-fd-stream on sbcl and that allow specifying (:no-unlink t) when
opening temporary files.

Thanks much.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Stop-ignoring-pathname-parameter-in-sbcl-make-fd-str.patch
Type: text/x-diff
Size: 1004 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/osicat-devel/attachments/20101217/803613b7/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Allow-creation-of-temporary-files-without-immediatel.patch
Type: text/x-diff
Size: 4817 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/osicat-devel/attachments/20101217/803613b7/attachment-0001.patch>


More information about the osicat-devel mailing list