From: "kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core" Date: 2024-05-18T10:16:52+00:00 Subject: [ruby-core:117913] [Ruby master Feature#20492] Debug option for tempfile Issue #20492 has been updated by kjtsanaktsidis (KJ Tsanaktsidis). Since you say you're OK with solutions requiring modifying the program though, have you tried doing something like this? ``` Tempfile::Remover.class_eval { def call(...) = nil } ``` I realise if this is a common use-case it would be nice to provide a toggle or some such in the tempfile module which did this with less patching though. Is this a problem that other people on this list have run into before, I wonder? ---------------------------------------- Feature #20492: Debug option for tempfile https://bugs.ruby-lang.org/issues/20492#change-108329 * Author: hadmut (Hadmut Danisch) * Status: Open ---------------------------------------- Hi, the ruby lib tempfile is quite useful, but since it always deletes files once the object is garbage collected or the program terminates (or the program explicitely asks to remove the file) it is difficult to debug programs and to check the file contents, after program termination. Replacing all tempfile uses with regular file operations is awkward. It therefore would be useful, if file deletion of tempfiles could be completely turned of e.g. through an environment variable or by the program itself, like through a --debug option or when catching errors, like deleting all files during normal program termination, but not if there's a runtime error. regards -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/