Looking through the 1.7 source, I don’t immediately see any wrapper for
mktemp or mkstemp. Is there an easy way with Ruby to create temporary
files?
Thanks,
Paul
Looking through the 1.7 source, I don’t immediately see any wrapper for
mktemp or mkstemp. Is there an easy way with Ruby to create temporary
files?
Thanks,
Paul
See the Tempfile class in Pickaxe.
Gavin
----- Original Message -----
From: “Paul Brannan” pbrannan@atdesk.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, September 25, 2002 5:23 AM
Subject: ruby and mktemp/mkstemp
Looking through the 1.7 source, I don’t immediately see any wrapper for
mktemp or mkstemp. Is there an easy way with Ruby to create temporary
files?Thanks,
Paul
Hahaha, I’ve even used that class before and I had forgotten all about
it.
Looking at the source, it appears to do the right thing (though I’m no
expert). The only thing that looks strange is the creation of the lock
directory; it seems to me that the function could just try to open() the
file to begin with; if the open() call fails, then the file probably
already existed.
I wonder if Ruby has been ported to a system on which O_EXCL is broken?
It would also be nice if Tempfile.open took a block.
Paul
On Wed, Sep 25, 2002 at 07:42:10AM +0900, Gavin Sinclair wrote:
See the Tempfile class in Pickaxe.
Gavin