Feature #11715 ยป tempfile.patch
| lib/tempfile.rb | ||
|---|---|---|
|
yield tmpfile
|
||
|
ensure
|
||
|
tmpfile.close if !tmpfile.closed?
|
||
|
File.unlink tmpfile
|
||
|
begin
|
||
|
File.unlink tmpfile
|
||
|
rescue Errno::ENOENT
|
||
|
end
|
||
|
end
|
||
|
else
|
||
|
tmpfile
|
||
| test/test_tempfile.rb | ||
|---|---|---|
|
assert(!File.exist?(path))
|
||
|
end
|
||
|
def test_create_with_unlink_in_block_silently_fails
|
||
|
assert_nothing_raised {
|
||
|
Tempfile.create("tempfile-create") {|f|
|
||
|
f.close
|
||
|
File.unlink f.path
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
def test_create_without_block
|
||
|
path = nil
|
||
|
f = Tempfile.create("tempfile-create")
|
||