summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
authorYuta Saito <[email protected]>2024-11-15 20:51:59 +0000
committergit <[email protected]>2024-11-18 04:19:40 +0000
commit6c142d05fa7446cccffc36d81b3ca98ae6199c83 (patch)
tree1ff5a83bba20175ad677b18233e144c5496338bb /lib/tempfile.rb
parent62007415c48a1d45516c4b132ddd3a11ceed70cb (diff)
[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
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb4
1 files changed, 1 insertions, 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