From 6c142d05fa7446cccffc36d81b3ca98ae6199c83 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 15 Nov 2024 20:51:59 +0000 Subject: [PATCH] [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 --- lib/tempfile.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/tempfile.rb b/lib/tempfile.rb index af953a6c12..37df96f63a 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -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