Skip to content

Cannot delete file after requiring it on Windows in 9.0.0.0.rc1 #3055

@jeremyevans

Description

@jeremyevans

Looks like this broke between pre1 and pre2:

D:\>C:\jruby-9.0.0.0.pre1\bin\jruby -e "File.open('a.rb', 'a'){}; require './a.rb'; File.delete('a.rb'); p 1"
1

D:\>C:\jruby-9.0.0.0.pre2\bin\jruby -e "File.open('a.rb', 'a'){}; require './a.rb'; File.delete('a.rb'); p 1"
Errno::EACCES: Permission denied - a.rb
  delete at org/jruby/RubyFile.java:1116
   <top> at -e:1

D:\>C:\jruby-9.0.0.0.rc1\bin\jruby -e "File.open('a.rb', 'a'){}; require './a.rb'; File.delete('a.rb'); p 1"
Errno::EACCES: Permission denied - a.rb
  delete at org/jruby/RubyFile.java:1116
   <top> at -e:1

It doesn't matter if the a.rb file already exists or if the process creates it, trying to delete it after requiring it raises the error.

Found by running Sequel's specs.

I didn't test on a *nix, but it's unlikely to be a problem there as *nix allows deletion of files that are in use.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions