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