From: Robert Klemme Date: 2004-10-12T22:14:36+09:00 Subject: Re: tempfiles created by tmpfile removed at exit - can I change this easily? "Graham Nicholls" schrieb im Newsbeitrag news:416bcf5a$0$1555$afc38c87@auth.uk.news.easynet.net... > Hi, I think the subject says it all, really. I'm trying to debug a script > (I think I'd call it a script as it is replacing a bash script), and if I > give -d as an argument to the script, then I'd like the tempfile not to be > deleted on exit. Will I have to override the close method in tmpfile, or > is there an easier way, please? > > Thanks > Graham Nicholls > -- The answer's always "Yes". Now, what's the question? No, serious: overriding Tempfile#close won't help as that has no impact on the file deletion. If it's just for debugging, you can just copy the temp dir contents before the script terminates. Alternatively you can try ObjectSpace.undefine_finalizer(tempfile) to prevent deletion. I didn't test this, just looked at the source. But chances are good that it works. :-) Kind regards robert