[ruby/tempfile] Stop using IO::NULL for feature detection

`IO::NULL`'s underlying file `/dev/null` is not always available on
WASI, so use of the file on top-level code (introduced in
https://github.com/ruby/tempfile/pull/36) causes tempfile library not
to work at all on WASI.

https://github.com/ruby/tempfile/commit/d50939890e
This commit is contained in:
Yuta Saito 2024-11-15 20:51:59 +00:00 committed by git
parent 62007415c4
commit 6c142d05fa

View File

@ -593,9 +593,7 @@ private def create_with_filename(basename="", tmpdir=nil, mode: 0, **options)
end
end
File.open(IO::NULL) do |f|
File.new(f.fileno, autoclose: false, path: "").path
rescue IOError
if RUBY_VERSION < "3.2"
module PathAttr # :nodoc:
attr_reader :path