Skip to content

Commit d509398

Browse files
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 #36) causes tempfile library not to work at all on WASI.
1 parent 2ff9b3c commit d509398

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/tempfile.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,7 @@ class << Tempfile
593593
end
594594
end
595595

596-
File.open(IO::NULL) do |f|
597-
File.new(f.fileno, autoclose: false, path: "").path
598-
rescue IOError
596+
if RUBY_VERSION < "3.2"
599597
module PathAttr # :nodoc:
600598
attr_reader :path
601599

0 commit comments

Comments
 (0)